Hello to everybody.
I have this page structure:
Parent Page
- child1 content_block
- child2 content_block
- childn content_block
The user can add/delete/edit the children pages.
My intention is to include content_block of all n-child pages into one partent page, as a sort of query.
I then tried to search for the help of $cgsimple->get_children.
First, trying with the example loop on documentation page of CGSimpleSmarty:
{$cgsimple->get_children('','',$children)}
{if count($children)}
{foreach from=$children item='child'}
{if $child.show_in_menu}
Child: id = {$child.id} alias = {$child.alias};
{/if}
{/foreach}
{/if}
But with no output.... then I tried a simplified form that is:
{$cgsimple->get_children('','',$child)}
{$child.id}
And even this outputs none; I used that CGSimple code on the template of parent page.
I'm sure that 'Parent' page is recognized to have children with {$cgsimple->has_children()} returning 1.
But I cannot explain this behaviour..
Where is my mistake?
Thank you in advance!
Alex (italy)
(SOLVED) Problem with $cgsimple->get_children
(SOLVED) Problem with $cgsimple->get_children
Last edited by alzambo on Sat Feb 20, 2010 11:31 am, edited 1 time in total.
Re: Problem with $cgsimple->get_children
Hi,
It appears example is incorrect in the module help section. I just created a bug for this 4619
The good news is that the argument descriptions appear correct. So, if you follow what they say, you should be able to get this to work:
get_children([$alias],[$showinactive],[$assign])
Return an array containing information about a pages children (if any)
Arguments:
* [$alias] - (optional) The page alias to test. If no value is specified, the current page is used.
* [$showinactive] - (optional) Wether inactive pages should be included in the result (defaults to false).
* [$assign] - (optional) The name of a variable to assign the results to.
Perhaps this modified version of the example get_children() call will work better for you (changes are underlined)...
{$cgsimple->get_children('',false,'children')}
Hope this helps,
Fred P.
It appears example is incorrect in the module help section. I just created a bug for this 4619
The good news is that the argument descriptions appear correct. So, if you follow what they say, you should be able to get this to work:
get_children([$alias],[$showinactive],[$assign])
Return an array containing information about a pages children (if any)
Arguments:
* [$alias] - (optional) The page alias to test. If no value is specified, the current page is used.
* [$showinactive] - (optional) Wether inactive pages should be included in the result (defaults to false).
* [$assign] - (optional) The name of a variable to assign the results to.
Perhaps this modified version of the example get_children() call will work better for you (changes are underlined)...
{$cgsimple->get_children('',false,'children')}
Hope this helps,
Fred P.
Last edited by fredp on Fri Feb 19, 2010 4:22 am, edited 1 time in total.
Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
- Abraham Lincoln
Re: Problem with $cgsimple->get_children
No,fredp wrote: {$cgsimple->get_children('',false,'children')}

it doesn't work.
I suspect that this bug to do with mle support...could it be true?
Re: Problem with $cgsimple->get_children
I don't know. I haven't used MLE. The modified example, however, does work for me with CGSimpleSmarty 1.4.3 on a CMSMS 1.6.6 installation:alzambo wrote:No,fredp wrote: {$cgsimple->get_children('',false,'children')}
it doesn't work.
I suspect that this bug to do with mle support...could it be true?
Code: Select all
This is a test of get_children<br />
{$cgsimple->get_children('',false,'children')}
{if count($children)}
{foreach from=$children item='child'}
{if $child.show_in_menu}
Child: id = {$child.id} alias = {$child.alias}<br/>
{/if}
{/foreach}
{/if}
Code: Select all
This is a test of get_children
Child: id = 25190 alias = child-1
Child: id = 25191 alias = child-2
Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
- Abraham Lincoln
Re: Problem with $cgsimple->get_children
I tried your routine on a fresh installation, without any content except for one partent page two children, but still doesn't work.
I've solved anyway using content_dump.
Thank you!
Alex
I've solved anyway using content_dump.
Thank you!
Alex
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: (SOLVED) Problem with $cgsimple->get_children
It could be true, I don't test with the MLE version because it is an 'unsupported fork'.I suspect that this bug to do with mle support...could it be true?
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.