Page 1 of 1

[solved]CGSimpleSmarty and get_sibling

Posted: Mon Aug 06, 2012 8:36 pm
by Jean le Chauve
get_sibling($direction[,$assign][,$alias])
Returns the alias of the next or previous sibling to the specified page. or false.
1.11 svn 8215
CGExtension 1.30
CGSimpleSmarty 1.5.2
url_rewrite on

{$cgsimple->get_sibling("next","next_sibling")}{$next_sibling} return the alias in the same hierarchy, so :
parent1 gives alias of parent2, not the alias of his first child
Child 1.1 gives alias of 1.2 and "false" for the last child 1.

Bug or it is a mistake in help or I did not quite understood the meaning of sibling ?

Re: CGSimpleSmarty and get_sibling

Posted: Mon Aug 06, 2012 9:03 pm
by calguy1000
sibling == 'brother or sister'.

so given a hierarchy like this:

1 parent_1
1.1 child_a
1.2 child_b
2 parent_2
2.1 child_c
2.2 child_d
2.3 child_e

$cgsimple->get_sibling(-1,'child_d'); should return 'child_c'
$cgsimple->get_sibling(1,'child_d'); should return 'child_e'
$cgsimple->get_sibling(-1,'parent_2'); should return 'parent_1';
$cgsimple->get_sibling(,'parent_2'); should return nothing... because there is no next sibling.

Re: CGSimpleSmarty and get_sibling

Posted: Mon Aug 06, 2012 9:07 pm
by Jean le Chauve
Thank you for the explanation and sorry to have lost time