Recent Topics

1 Jun 13, 2011 07:56    

Hi, what code can I use if I want to call a specific post, like for instance I have 200 posts and I would like to call post item with id 44

2 Jun 13, 2011 20:11

$ItemCache = & get_ItemCache();
$Item = & $ItemCache->get_by_ID(44);

If you are not sure that particular Item exists, use this instead

if( $Item = & $ItemCache->get_by_ID( 44, false ) )
    // Valid Item

Same applies to Blog, Skin, Chapter (category)

$BlogCache = & get_BlogCache();
$Blog = & $BlogCache->get_by_ID(44);

4 Jul 06, 2011 17:47

What if I want to display the id for the currant post being viewed like when using


, instead of viewing the id for the currant blog displayed, you will view the id for the currant post displayed?



5 Jul 06, 2011 20:52

Got it thanks.

	global $Blog, $Item;
		$this_blog = $Blog->ID;
		$this_post = $Item->ID; 

6 Jul 06, 2011 23:56

$Item object is only defined globally (not in post loop) only in a single post/page view. Use this additional check.

global $Blog, $Item;
$this_blog = $Blog->ID;

if( !empty($Item) )
    $this_post = $Item->ID;

7 Jul 07, 2011 15:25

Updated, thanks. (:

I only need it in this instance for single post view and pages, modified images linked to posts to display in either thumb or not and list view or grid. (similar to media index), but instead only images for the post viewed.

Integrated it with a lightbox, so images linked to a post are now displayed as a gallery. Works great and looks nifty.

Form is loading...

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