Recent Topics

[2.x] Identify Page and Post

Started by on Jul 02, 2011 – Contents updated: Jul 02, 2011

Jul 02, 2011 10:46    

My b2evolution Version: 2.x

Hi. I would like to specify where and if an object is to be displayed.

I have created the skin settings to say I would like to display an object after each post. Now I would like to be able to specify that it does not display at the bottom of a page, or that it is, but not after each post.

The object may be a like button, or a print button or a word count est.

So basically I would like to determine if the item displayed is a post or a page? I figured to use:


globals $disp;
if ($disp == 'posts') {
if ($disp 'single'){echo 'This is a post';}
if ($disp 'page') {echo 'this is a page';}
if ($disp != 'single'){echo 'This not a post';}
if ($disp != 'page') {echo 'this is not a page';}

is there a better way to do this?

Jul 02, 2011 15:19

Instead of '=' use '==', other than that the code should do what you want. You can also check $disp_detail ;)

If you want to add something before or after each item use "DisplayItemAsHtml" method. And then check if it is a single post or


function DisplayItemAsHtml( & $params )
    globals $disp;
    if ($disp == 'posts') echo 'item in the loop';
    if ($disp != 'posts') echo 'single post/page/podcast or whatever';

Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.