[solved] generate parent name in menu
-
- Forum Members
- Posts: 18
- Joined: Tue Jan 29, 2008 11:29 pm
[solved] generate parent name in menu
I was hoping someone could help me generate the parent name in a menu. Any ideas?
Last edited by chiggeybean on Thu Feb 07, 2008 5:35 pm, edited 1 time in total.
-
- Forum Members
- Posts: 18
- Joined: Tue Jan 29, 2008 11:29 pm
Re: generate parent name in menu
To further clarify:
If using the following menu:
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
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}
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
-
- Forum Members
- Posts: 18
- Joined: Tue Jan 29, 2008 11:29 pm
Re: [solved] generate parent name in menu
This custom tag solved my problem with a couple of tweaks to show the menu_text instead.
http://dev.cmsmadesimple.org/projects/sectiontitle
http://dev.cmsmadesimple.org/projects/sectiontitle