Page 1 of 1

Check for last chilld in menu.

Posted: Thu Sep 24, 2009 7:24 pm
by idledragon
I'm very close to finishing a menu that I've struggled with for a very long time.  I have a menu something like this
1.1
1.2
1.3
2.1
2.2
3.1
3.2
3.3
3.4....

Is there any way to check with a {if} statement if a page is the last child in a menu?

Basically I want to close a div when I hit the last page in a sub list.  In this instance 1.3, 2.2, 3.4.

I open the div whenever there is a new parent, but need to close it after the last child.

Re: Check for last chilld in menu.

Posted: Thu Sep 24, 2009 7:30 pm
by RonnyK
Check... http://forum.cmsmadesimple.org/index.ph ... #msg152295

There is logic there that checks if a level hits the last element...

Ronny

Re: Check for last chilld in menu.

Posted: Thu Sep 24, 2009 9:23 pm
by idledragon
Thanks,

Although for some reason it doesn't seem to be working quite right for me.  I tried

Code: Select all

{$cgsimple->get_sibling("prev","prev_sibling")}{if !empty($prev_sibling)}{cms_selflink page="$prev_sibling" text="Previous"}{/if}

Code: Select all

{$cgsimple->get_sibling("next","next_sibling")}{if !empty($next_sibling)}{cms_selflink page="$next_sibling" text="Next"}{/if}
Just to see if the text would show up in my menu (Previous and Next).  For some reason, 'Previous' shows up (after each item) "next" never shows.  Any ideas? (I tried this instead of the because the menu wasn't being generated correctly).

Re: Check for last chilld in menu.

Posted: Fri Sep 25, 2009 12:51 am
by idledragon
I actually got this working with the menu (section expand) that I was modifying.  I went about it in a slightly different way.