Recent Topics

1 May 14, 2007 17:35    

My b2evolution Version: Not Entered

Some new skins are starting to take advantage of the robots tag and the admin contact link that are new features to b2evolution. That can mean the skins won't work in older versions of b2evolution. Here's a simple way to make sure you skin works with older installs, too.

Instead of

<?php robots_tag(); ?>


use:

<?php if (function_exists('robots_tag')) robots_tag(); ?>

and instead of

<?php $Blog->contact_link() ?>


use this:

<?php if (method_exists($Blog, 'contact_link')) $Blog->contact_link() ?>

2 May 15, 2007 00:04

Danny, just some clarification..
I assume the robots tag generates...

<meta name="robots" content="index,follow" />


and the contact_link simply uses the msgform but is addressed to Admin?

3 May 15, 2007 00:45

Actually that's what I like to ask, when I check my source page (via a browser), the robots_tag didn't produce anything.

Will update my skins...

4 May 15, 2007 01:33

Yes, same here Laibcoms.
Is the robots tag dependent on some other file that's been updated?

5 May 15, 2007 02:07

robots_tag is not covered in the [url=http://doc.b2evolution.net/v-1-10/elementindex.html]element index[/url] so I found the function in inc/_misc/_template.funcs.php:

/**
 * Robots tag
 */
function robots_tag()
{
	global $robots_index, $robots_follow;

	if( is_null($robots_index) && is_null($robots_follow) )
	{
		return;
	}

	$r = '<meta name="robots" content="';

	if( $robots_index === false )
	 $r .= 'NOINDEX';
	else
	 $r .= 'INDEX';

	$r .= ',';

	if( $robots_follow === false )
	 $r .= 'NOFOLLOW';
	else
	 $r .= 'FOLLOW';

	$r .= '" />'."\n";

	echo $r;
}

robots_index appears to be set in inc/_blog_main.inc.php and inc/_vars.inc.php, and robots_follow appear to be set in the second file. Dunno what someone is supposed to do with the function though.

Anyway since 1.9.* skins work in 1.10, and it would be nice if 1.10 skins worked in 1.9.* skinners should wrap this function and the "contact_link" method in conditionals the way personman showed. That way skins with those things will still be good for 1.9.*, and eventually the value of those bits will be known.


Form is loading...