Include latest Child content within parent page

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
bartcha
New Member
New Member
Posts: 4
Joined: Fri Apr 17, 2009 5:19 pm

Include latest Child content within parent page

Post by bartcha »

hi,

I have been trying all kind of solutions to get this work. What i have is a simple tree for a sitesection with newsletters. The parent page should consist of the content of the most recent child-page. (All the others are accessible through the 'archive-listing').

Is seems like such an easy question - but i haven't managed yet...

anyone?!

thanks
Bart
nhaack

Re: Include latest Child content within parent page

Post by nhaack »

You could have a look at "Content_Dump": http://wiki.cmsmadesimple.org/index.php ... ntent_dump

It's a plug-in for pulling content from a selection of pages. You can then display e.g. the 4 newest pages on a parent page or things like these.

Best
Nils
bartcha
New Member
New Member
Posts: 4
Joined: Fri Apr 17, 2009 5:19 pm

Re: Include latest Child content within parent page

Post by bartcha »

Thanks for your answer. I actually have been looking at that tag before. Somehow i keep getting "Smarty-errors' which i cant get solved.

string(142) "Smarty error: [in content:content_en line 6]: syntax error: unrecognized tag: $dump->content->data (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 6]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)"

the code i have now is:

Code: Select all

{content_dump start_id="105" limit_count="1" first_sort="created" first_sort_order="down"}

{foreach from=$dump item=dump}

{$dump->content->data}

{/foreach}
nhaack

Re: Include latest Child content within parent page

Post by nhaack »

mhh... I exactly copied your sample (except for the ID) and it works with no problem. You could try adding { ... assign="dump" ... }.  I'm not 100% sure if the public version requires a value for that parameter or not atm. You could also try naming your item e.g. "dump_item" and use

Code: Select all


{content_dump start_id="105" limit_count="1" first_sort="created" first_sort_order="down" assign="dump"}

{foreach from=$dump item=dump_item}

{$dump_item->content->data}

{/foreach}

Let me know if that helped you.

Best
Nils
bartcha
New Member
New Member
Posts: 4
Joined: Fri Apr 17, 2009 5:19 pm

Re: Include latest Child content within parent page

Post by bartcha »

Hi Nils,

Thanks again for thinking with me. Unfortunately no luck. Still the Smarty-error. This is the exact copy of what i tried.

Code: Select all

{content_dump start_id="105" limit_count=1 first_sort="created" first_sort_order="down" assign="dump"}

{foreach from=$dump item=dump_item}

{$dump_item->content->data}

{/foreach}
and still the error:

string(147) "Smarty error: [in content:content_en line 5]: syntax error: unrecognized tag: $dump_item->content->data (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 5]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)"

If i leave the foreach-loop out i get no error. Not sure if that means that the "tag" is parsed correctly and should work?
Is there anything else to consider in the code? I can just paste the code in the WysiWyg-editor, right? (i automatically start looking for something 'stupid' ;-)

cheers
Bart
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: Include latest Child content within parent page

Post by Jeff »

Using CGSimpleSmarty.

{$cgsimple->get_children('','',$children)}
{section name=foo loop=$children step=-1 max=1}
{$cgsimple->get_page_content($children[foo].alias,'',$child_content)}
{eval var=$child_content}
{/section}
Post Reply

Return to “Developers Discussion”