Page 1 of 1

[solved] generate parent name in menu

Posted: Wed Jan 30, 2008 4:08 am
by chiggeybean
I was hoping someone could help me generate the parent name in a menu. Any ideas?

Re: generate parent name in menu

Posted: Wed Jan 30, 2008 10:19 pm
by chiggeybean
To further clarify:

If using the following menu:

Code: Select all

<div class="navtitle">
Menu:
</div>
{if $count > 0}

<ul>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}

{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}

	{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
	</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
	<li><a class="x" 
{elseif $node->current == true}
	<li><a class="menuactive" 
{elseif $node->haschildren == true}
	<li><a class="x" 
{elseif $node->type == 'sectionheader'}
        <li>{$node->menutext}
{elseif $node->type == 'separator'}
        <li> 
{else}
	<li><a 
{/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
href="{$node->url}" {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}
>{$node->menutext}</a>
{/if}

{/foreach}

	{repeat string="</li></ul>" times=$node->depth-1}		</li>
	</ul>


{/if}
Referenced in my templates with {menu template='sidenav' start_level="3"}

At the beginning, I like to insert the parent name in the div: Menu: in place of "Menu". When I say parent I guess I really mean the name of the level I'm starting at.

thanks

Re: [solved] generate parent name in menu

Posted: Thu Feb 07, 2008 5:35 pm
by chiggeybean
This custom tag solved my problem with a couple of tweaks to show the menu_text instead.
http://dev.cmsmadesimple.org/projects/sectiontitle