Check for last chilld in menu.

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
idledragon
Forum Members
Forum Members
Posts: 43
Joined: Thu Mar 13, 2008 8:16 pm

Check for last chilld in menu.

Post 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.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Check for last chilld in menu.

Post by RonnyK »

Check... http://forum.cmsmadesimple.org/index.ph ... #msg152295

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

Ronny
idledragon
Forum Members
Forum Members
Posts: 43
Joined: Thu Mar 13, 2008 8:16 pm

Re: Check for last chilld in menu.

Post 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).
idledragon
Forum Members
Forum Members
Posts: 43
Joined: Thu Mar 13, 2008 8:16 pm

Re: Check for last chilld in menu.

Post 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.
Post Reply

Return to “Layout and Design (CSS & HTML)”