Recent Topics

1 Jan 22, 2007 17:07    

Dear users/staff,

At http://virtualreality.se/blogs/ (yeah, I know, it's in Swedish only :-) ), I currently have 2 blogs, but I plan to add more blogs in the future.

I would like to find an easy way to add different affiliate banners, at the bottom of the sidebar, for each blog.

The banners are shown with a chunk-of-javascript-code.

One way would of course be to use different skins for each blog, but that doesn't seem like a very clever solution. :-)

In _main.php I want something like (please bear with me, I'm a c-programmer):

if(blog_id==1)
{
run chunk-of-javascript-code#1
}
if(blog_id==2)
{
run chunk-of-javascript-code#2
}
...
...

Ho do I do this in php?

Regards,
Jor-el

2 Jan 22, 2007 19:51

$sb_file = dirname(__FILE__).'/_sidebar-'.$Blog->ID.'.php';
	if( is_file( $sb_file ) )
	{
	  include $sb_file;
	}
	else
	{
	include dirname(__FILE__).'/_sidebar-default.php';
	}		

3 Jan 22, 2007 22:12

Thanx mate!
Exactly what I wanted. I even understood the code after some thinking. :D


Form is loading...