Warning: gzinflate() [function.gzinflate]: data error in /home/boozkerc/public_html/kneedeepincode/wp-includes/http.php on line 1787

parent_page_in_c5

I love Concrete5 and for the most part, creating themes for it is actually very easy. I’d say easier than WordPress. Recently however I was slicing a theme that needed to have the current page title and the parent page title on each sub page. Easy… right?

Well, to get the current page title was easy and it was simply:

<?php echo $c->getCollectionName(); ?>

Great! Then I went to get the parent page title and… eek.

About an hour later of searching and going through the API (which is a mess) I came up with this:

<?php
     $parent = Page::getByID($c->getCollectionParentID()); echo $parent->getCollectionName();
?>

I like Concrete5, but the API documentation needs to be cleaner and laid out better. Sort of like jQuery’s API documentation

[Post to Twitter]   [Post to Delicious]   [Post to Digg]   [Post to Reddit]   [Post to StumbleUpon]  

Andrea 30.09.10

This came in handy for me just now, thanks for posting. Hope you come up with some kind of a cheat sheet and share (hint hint .. LOL). Thanks again.

Justin 11.03.11

If it gives you an error, replace $c with $cobj like the following:

getCollectionParentID()); echo $parent->getCollectionName(); ?>

Justin 11.03.11

If it gives you an error, replace $c with $cobj like the following:

[code]getCollectionParentID()); echo $parent->getCollectionName(); ?>[/code]