April 12, 20091 Comment

I think JW Player(flash player) by longtailvideo.com is well known to u all. There are so many extension for joomla, wordpress, drupal and other cms using this tool. Simple_video_flash_player is a joomla module to show flash and other videos. Today I used it with one of project. But after checking in ie6 I was tempered becuase it was showing a js error in ie and the modules config file I meant he xml file has not param to show module class suffix which is very important to style module using css. I searched google and got so many solution. Here is my code that helped to solve this issue in ie6.

Here is portion module code I mean the main php file of this module (mod_simple_video_flash_player.php)

<div id="videoplayer<?php echo $count ?>">Video Advert</div>
<script src="<?php echo JURI::base();?" type="text/javascript">// < ![CDATA[
  modules/mod_simple_video_flash_player/swfobject.js">
// ]]></script><script type="text/javascript">// < ![CDATA[
 /* function show_simple_video_flash_player(){ var s1 = new SWFObject("< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>","ply< ?php echo $count ?>","< ?php echo $width ?>","< ?php echo $height ?>","< ?php echo $version ?>","#FFFFFF"); s1.addParam("allowfullscreen","true"); s1.addParam("allowscriptaccess","always"); s1.addParam('wmode','opaque'); s1.addVariable("width","< ?php echo $width ?>"); s1.addVariable("height","< ?php echo $height ?>"); s1.addParam("flashvars","file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>"); s1.write("videoplayer< ?php echo $count ?>"); //alert("hi"); } */window.addEvent('domready', function(){ var s1 = new SWFObject("< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>","ply< ?php echo $count ?>","< ?php echo $width ?>","< ?php echo $height ?>","< ?php echo $version ?>","#FFFFFF"); s1.addParam("allowfullscreen","true"); s1.addParam("allowscriptaccess","always"); s1.addParam('wmode','opaque'); s1.addVariable("width","< ?php echo $width ?>"); s1.addVariable("height","< ?php echo $height ?>"); s1.addParam("flashvars","file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>"); s1.write("videoplayer< ?php echo $count ?>"); });
// ]]></script>

If u check the last lines I meant he js code that embed the flash player to that a div having a id like videoplayer1, videoplayer2 etc.

Here the problem was with the width and height problem for ie and I solved just adding two extra var for height and with like bellow

s1.addVariable("width","< ?php echo $width ?>");
s1.addVariable("height","< ?php echo $height ?>");

To I have retouched the js code so that the flash object is added after the window is load I mean the dom is ready so that no issue about id unavailability

Just check my code and compare with the original code

/* function show_simple_video_flash_player(){ var s1 = new SWFObject("< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>“,”ply< ?php echo $count ?>“,”< ?php echo $width ?>“,”< ?php echo $height ?>“,”< ?php echo $version ?>“,”#FFFFFF”); s1.addParam(”allowfullscreen”,”true”); s1.addParam(”allowscriptaccess”,”always”); s1.addParam(’wmode’,'opaque’); s1.addVariable(”width”,”< ?php echo $width ?>“); s1.addVariable(”height”,”< ?php echo $height ?>“); s1.addParam(”flashvars”,”file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>“); s1.write(”videoplayer< ?php echo $count ?>“); //alert(”hi”);

} */window.addEvent(’domready’, function(){ var s1 = new SWFObject(”< ?php echo JURI::base();;?>modules/mod_simple_video_flash_player/< ?php echo $player ?>“,”ply< ?php echo $count ?>“,”< ?php echo $width ?>“,”< ?php echo $height ?>“,”< ?php echo $version ?>“,”#FFFFFF”); s1.addParam(”allowfullscreen”,”true”); s1.addParam(”allowscriptaccess”,”always”); s1.addParam(’wmode’,'opaque’); s1.addVariable(”width”,”< ?php echo $width ?>“); s1.addVariable(”height”,”< ?php echo $height ?>“); s1.addParam(”flashvars”,”file=< ?php echo $video ?>< ?php echo $preview ?>< ?php echo $logo ?>< ?php echo $link ?>< ?php echo $repeat ?>< ?php echo $shuffle ?>< ?php echo $autostart ?>“); s1.write(”videoplayer< ?php echo $count ?>“); });

Again as the default module’s config file mod_simple_video_flash_player.xml has no param for module class suffix so I added just one line.

and the whole file’s code is like now

< ?xml version="1.0" encoding="utf-8"?><install type="module" version="1.5"> <name>Simple Video Flash Player Module</name> <author>www.time2online.de</author> <creationdate>01/23/2009</creationdate> <copyright>time2online</copyright> <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license> <authoremail>i...@time2online.de</authoremail> <authorurl>http://www.time2online.de</authorurl> <version>1.5</version> <description> < ![CDATA[ <p># Simple Video Flash Player Module # <p>For download, demo and documentation use http://www.time2online.de.</p> <p># JW Player License #</p> <p>Below you see a simple embedded example of the JW Player!</p> <p>Licensing: The player is licensed under a http://creativecommons.org/licenses/by-nc-sa/2.0/ Creative Commons License. It allows you to use, modify and redistribute the script, but only for noncommercial purposes.</p> <p>For corporate use, http://www.longtailvideo.com/players/order Order commercial licenses please apply for a commercial license.</p> ]]> </description> <files> <filename module="mod_simple_video_flash_player">index.html</filename> <filename module="mod_simple_video_flash_player">mod_simple_video_flash_player.php</filename> <filename module="mod_simple_video_flash_player">demo.flv</filename> <filename module="mod_simple_video_flash_player">jwplayer.swf</filename> <filename module="mod_simple_video_flash_player">miniplayer.swf</filename> <filename module="mod_simple_video_flash_player">yt.swf</filename> <filename module="mod_simple_video_flash_player">swfobject.js</filename> </files> <params> <param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="player_variant" type="list" default="jwplayer" label="Player" description="choose jw player, mini player or youtube player (default value is jw player)"> <option value="jwplayer">JW Player</option> <option value="miniplayer">Mini Player</option> <option value="yt">Youtube Player</option> </param> <param name="width" type="text" default="200" label="Video Width" description="the width of the flash player (default value is 200)" /> <param name="height" type="text" default="200" label="Video Height" description="the height of the flash player (default value is 200)" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="video_url" type="text" default="demo.flv" label="Single Video URL" description="edit flash video url (for example http://content.bitsontherun.com/videos/3ta6fhJQ.flv)" /> <param name="preview_url" type="text" default="" label="Preview Image URL" description="edit preview image url (for example http://content.bitsontherun.com/thumbs/qyehIiBT.jpg)" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="playlist_url" type="text" default="" label="Multi Playlist URL" description="edit url for the rss file to play (for example http://www.longtailvideo.com/jw/upload/mrss.xml)" /> <param name="playlist_position" type="list" default="over" label="Playlist Position" description="position of the playlist (default value is none)" > <option value="">None</option> <option value="over">Over</option> <option value="right">Right</option> <option value="bottom">Bottom</option> </param> <param name="playlist_size" type="text" default="180" label="Playlistsize" description="edit height or width of the playlist (default is 180)" /> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="logo_url" type="text" default="" label="Logo URL" description="edit logo image url (for example http://www.longtailvideo.com/jw/upload/longtail.png)" /> <param name="link_url" type="text" default="" label="Link URL" description="edit link to an external site (for example http://www.joomla.org)" /> <param name="autostart" type="radio" default="0" label="Autostart" description="automatically start playing (default value is no)" > <option value="1">Yes</option> <option value="0">No</option> </param> <param name="playlist_repeat" type="list" default="" label="Repeat" description="continously repeat playback (default value is no)" > <option value="">No</option> <option value="repeat=always">Always</option> <option value="repeat=list">List</option> </param> <param name="playlist_shuffle" type="list" default="" label="Shuffle" description="shuffle playlist order (default value is no)" > <option value="">No</option> <option value="shuffle=true">Shuffle</option> </param> <param name="version" type="text" default="6" label="Flash Version" description="edit the minimum version of flash player (default value is 6)" /> <param name="count" type="text" default="1" label="Flash Player ID" description="edit video flash player id" /> </params> <params group="advanced"> <param name="cache" type="list" default="1" label="Caching" description="Select whether to cache the content of this module"> <option value="1">Use global</option> <option value="0">No caching</option> </param> <param name="cache_time" type="text" default="900" label="Cache Time" description="The time before the module is recached" /> </params></install>

One thing to note that that modules uses a free js tool to embed flash in html and that can be found here. So if there is any error about the swfobject.js then u can download the latest one from the above link.

Bye for today.

April 1, 2009Leave a Comment

I always like to share web related silly problems that I face in my works.
If u are a joomla fan and u like to make a image gallery in joomla then rsgallery2 can be ur better(to me it’s best) choise. But one thing that I faced in joomla1.5(don’t know about the condition in joomla1.x series) about rsgallery2 is it’s title and pathway problem when it’s just connected as component from menu I mean just when u go to rsgallery2 as from menu as a component it doesn’t show any breadcrumb(pathway) and pagetitle

I searched google and joomla forum for this but didn’t get much help actually. BTW, at this time the rsgallery2 site is down for maintenance. So I gave a try to fix this as I always do.

At first let me clear about the problem. When first time u will go to rsgallery2 as component, in this condition no gallery is selected and no items in any gallery ie, no gallery id or current gallery is as no gallery id

Not clear yet, check the code in com_rsgallery2\templates\meta\display.class.php and in function showRSPathWay()…To get it clearly u have to check this function dear

see this
if ( $gallery->id == $currentGallery && empty($item) )

this is true when just go to rsgallery2 because no items and both the gallery id is null and currentgallery id is null and
as it’s true the code is executed as $pathway->addItem($gallery->name );
but as gallery id is null then it’s doesn’t show any gallery name… isn’t it a bug huh ? that means pathway fails to show any thing for this condition and same problem in
function metadata() which shows the pagetitle for rsgallery2 and meta information.

Here is the code that I edited for those two functions

/**     * shows proper Joomla path     */	function showRSPathWay() {		global $mainframe, $mosConfig_live_site, $Itemid, $option;		// if rsg2 isn't the component being displayed, don't show pathway		if( $option != 'com_rsgallery2' )			return;		$gallery = rsgInstance::getGallery();		$currentGallery = $gallery->id;		$item = rsgInstance::getItem();		$galleries = array();		$galleries[] = $gallery;		while ( $gallery->parent != 0) {			$gallery = $gallery->parent();			$galleries[] = $gallery;		}		$galleries = array_reverse($galleries);		if( defined( 'J15B_EXEC' ) ){			// J1.0 method			foreach( $galleries as $gallery ) {				if ( $gallery->id == $currentGallery &amp;&amp; empty($item) ) {					$mainframe->appendPathWay($gallery->name);				} else {					$mainframe->appendPathWay('<a href="' . JRoute::_('index.php?option=com_rsgallery2&amp;Itemid='.$Itemid.'&amp;gid=' . $gallery->id) . '">' . $gallery->name . '</a>');				}			}			if (!empty($item)) {				$mainframe->appendPathWay( $item->title );			}		}		else{			// J1.5 method			$pathway =&amp; $mainframe->getPathway();			/*Edit by manchumahara*/			$document	=&amp; JFactory::getDocument();			$params = &amp;$mainframe->getParams();			$menus	= &amp;JSite::getMenu();			$menu	= $menus->getActive();			$pagetitle = '';			if (is_object( $menu )) {				$menu_params = new JParameter( $menu->params );				if (!$menu_params->get( 'page_title')) {					$pagetitle = JText::_('MRSGALLERYTITLE');  //loading it from language file				}				else $pagetitle =$menu_params->get( 'page_title');			} else {					$pagetitle = JText::_('MRSGALLERYTITLE');  //loading it from language file			}			//$pagetitle = $mainframe->getPageTitle();			foreach( $galleries as $gallery ) {				if ( $gallery->id == $currentGallery &amp;&amp; empty($item) ) {					if($gallery->id== 0){						//gallery id zero and no items ie, if menu is link to component directly						$pathway->addItem($pagetitle);					}					else {						//gallery id not zero,ie gid id ok but no items in this gallery						$pathway->addItem($gallery->name );					}				} else {					$link = 'index.php?option=com_rsgallery2&amp;gid=' . $gallery->id;					$pathway->addItem( $gallery->name, $link );				}			}			/*Edit by manchumahara*/			/*Edit by manchumahara*/			if (!empty($item)) {				$mainframe->appendPathWay($item->title );				//$mainframe->appendPathWay( $title );			}			else {$mainframe->appendPathWay($pagetitle);}			/*Edit by manchumahara*/		}	}	/**	 * insert meta data into head	 */	function metadata(){		global $mainframe, $option;		// if rsg2 isn't the component being displayed, don not append meta data		if( $option != 'com_rsgallery2' )			return;		/*Edit by manchumahara*/		$document	=&amp; JFactory::getDocument();		$params = &amp;$mainframe->getParams();		$menus	= &amp;JSite::getMenu();		$menu	= $menus->getActive();		$pagetitle = '';		if (is_object( $menu )) {			$menu_params = new JParameter( $menu->params );			if (!$menu_params->get( 'page_title')) {				$pagetitle = JText::_('MRSGALLERYTITLE');  //loading it from language file			}			else $pagetitle =$menu_params->get( 'page_title');		} else {				$pagetitle = JText::_('MRSGALLERYTITLE');  //loading it from language file		}		/*Edit by manchumahara*/		$title = $this->gallery->get('name');		$description = htmlspecialchars(strip_tags($this->gallery->get('description')), ENT_QUOTES );		$item = rsgInstance::getItem();		if ($item != null){			$title .= ' - ' . $item->title;			$description .= ' -  ' . htmlspecialchars(strip_tags($item->descr), ENT_QUOTES );		}		/*Edit by manchumahara*/		if($title == ''){ $title = $pagetitle;}		/*Edit by manchumahara*/		$mainframe->setPageTitle( ' '. $title );		$mainframe->appendMetaTag( 'description',  $description );	}

BTW, as if there is nothig set as pagetitle from menu then I showed it from language file and for this I made an entry in language file as like this. Open en-GB.ini file and put this line at the end
MRSGALLERYTITLE = RSGallery2

  • Go to top
    Go to top
feedback