Recent Topics

1 May 08, 2007 11:57    

My b2evolution Version: 1.9.x

Hi,

I have a blog where I have links to entries in another blog. How can I put some code in _MAIN.PHP which is only executed if entries of the main blog are displayed (e.g. categories / archives). These code sequence should not be executed when a link to another blog (where my static content resides) is called.

I tried with "IF ($Blog-ID = 5) {}" but it seems that this variable is equal to the number of my first blog even if a link of another blog is called.

The only possibility I currently can see is to use two different skins for both blogs which I would like to avoid so that I do not need to make any changes to both skins.

Thanks for any hint,
Michael

2 May 08, 2007 12:11

if( $Blog->ID == 5 )
{
  // do stuff for blog 5 only
}
else
{
  // do stuff for all other blogs
}

¥

3 May 08, 2007 13:16

Thanks,

but the problem seems not to be the syntax of the IF clause but the fact that $Blog->ID has the same number (id of my main blog) regardless whether an entry of my main blog of an entry of my (static) blog is displayed.

P.S. The reason ssems to be that I call the static link directly (hardcoded) from _main.php.... So I need to find a way to identify to what blog number the current entry belong to, I suppose....

4 May 08, 2007 13:26

this might work :-

if( strpos( $ReqURI, '/static/' ) === true )
{
  // do stuff for a static page
}
else
{
  // do stuff for a non-static page
}

¥

5 May 11, 2007 09:23

Yes! This works for me.

Many thanks,
Michael

6 Jun 01, 2007 22:35

Looking to solve my own problem of having different designs for different blogs in the same installation, I came upon this thread here.
It seems to me that instead of identifying the blog id, you can use a stub file and set a variable in it like
$blogdesign= <and then a name of design>

Using a switch in _main.php you should then be able to load different column designs (for instance) for different blogs.

I did not find a way to load different _main.php files from the same skin.

Anyone tried this?


Form is loading...