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:

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:

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 + 5, 3) < 7.0) {
            $result .= " ></base>n";
        } else {
            $result .= " />n";
        }
    } else {
        $result .= " />n";
    }

    echo $result;
}

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

Share Article

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

Leave a reply

Please fill in the form fields and improve Skynet by completing the captcha!

Thank you! All comments are moderated so yours will appear shortly.

Listen sucka, I’m blacker than the ace of spades and more militant than you and your whole damn army put together. While you out there, chanting at rallies and brow-beating politicians, I’m taking out any money-fronting sucka on a humble that gets in my way. So I tell you what, when your so called revolution starts, you call me, and I’ll be right down front showing you how it’s done. But until then, you need to SHUT the FUCK UP when grown folks is talking.

— Black Dynamite