b2evolution Base Tag Issue

b2evolution uses a base tag to help with its template system. This is fine in modern browsers but depending on how the base tag is written IE6 may refuse to show the site at all, even going to the point of giving the user a popup warning dialogue. The fix is quite simple and I’ve implemented it in the past for both Joomla and CMS Made Simple. Now it’s time for the b2evolution version.

The following is for b2evolution v 3.3.3 and requires changing the file “inc/_core/_template.funcs.php”. After making a backup of the file, open the original and find the “base_tag” function. For me it looks like the following as default:

PHP:

function base_tag$url$target NULL )
   {
      global $base_tag_set;
      $base_tag_set $url;
      echo '<base href="'.$url.'"';
 
      if( !empty($target) )
         {
            echo ' target="'.$target.'"';
         }
      echo " />n";
   }

Change that to the following to allow the base tag to work with IE6:

PHP:

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

Voila! Your b2evolution blog is now viewable within IE6. Easy.

Comments: None so far...be the first!

Leave a reply

Your email address will not be published. Required fields are marked *

So, Barzini will move against you first. He’ll set up a meeting with someone that you absolutely trust, guaranteeing your safety. And at that meeting, you’ll be assassinated.

— Don Corleone