"A war is much more than arms and armour."

~ Jedi Knight Arca Jeth - Tales of the Jedi ~

newsblog

2009-07-03

Joomla and SWFObject IE6 Base Tag Issue Revisited

A while ago I wrote this post about how to get Joomla working with swfobject due to the base tag issue (swfobject FAQ Point #4). At some point Joomla has had what seems like a major rewrite and I found after a recent upgrade to 2.4.6 that the base tag issue is back again. To tell the truth I wasn't that happy with my last attempt but I also switched to using CMS Made Simpler instead of Joomla for most projects so haven't had the chance to revisit it. Seems like now is the time. The fix is simple and is based on one that I wrote for CMS Made Simple which in turn is based on one that someone wrote for Drupal.

...

Navigate to the Joomla root directory, then open /inc/_core/template.funcs.php. Search for "function base_tag" which for me is on line 307 and then replace the entire function with:

PHP:

function base_tag$url$target NULL )
{
   global $base_tag_set;
 
   $base_tag_set true;
 
   // Taken from a fix for Drupal - <a href="http://drupal.org/node/285255">http://drupal.org/node/285255</a>
   $browser $_SERVER['HTTP_USER_AGENT'];
   $result '';
 
   if(!empty($target))
      {
         if($msie strpos($browser"MSIE"))
            {
               if(substr($browser$msie 53) < 7.0)
                  {
                     $result .='<base href="'.$url.'" target="'.$target.'">\</base>'."\n";
                  }
               else
                  {
                     $result .= '<base href="'.$url.'" target="'.$target.'"/>'."\n";
                  }
            }
         else
            {
               $result .= '<base href="'.$url.'" target="'.$target.'"/>'."\n";
            }
      }
   else
      {
         if($msie strpos($browser"MSIE"))
            {
               if(substr($browser$msie 53) < 7.0)
                  {
                     $result .= '<base href="'.$url.'"></base>'."\n";
                  }
               else
                  {
                     $result .= '<base href="'.$url.'" />'."\n";
                  }
            }
         else
            {
               $result .= '<base href="'.$url.'" />'."\n";
            }
      }
 
   echo $result;
}

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)

search