Page 1 of 1
Include latest Child content within parent page
Posted: Wed Mar 17, 2010 9:34 am
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
Re: Include latest Child content within parent page
Posted: Sun Mar 21, 2010 2:40 pm
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
Re: Include latest Child content within parent page
Posted: Sun Mar 21, 2010 7:28 pm
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}
Re: Include latest Child content within parent page
Posted: Wed Mar 24, 2010 11:01 pm
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
Re: Include latest Child content within parent page
Posted: Thu Mar 25, 2010 5:41 pm
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
Re: Include latest Child content within parent page
Posted: Thu Mar 25, 2010 6:12 pm
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}