Page 1 of 1

Menu manager - how to convert my old menu

Posted: Sat Nov 22, 2008 3:39 am
by heffer86
I am trying to figure out how the menu manager works, but I have been having some trouble.  I looked at the documentation, but I just can't figure out the {if} statements.  I am good a reverse enginering code so could someone help me convert my current menu to work with menu manager?

Code: Select all

<ul id="nav">
  <li class="top"><a href="../whatsnew/" id="new" class="top_link"><span class="down">Whats New</span></a></li>
  <li class="top"><a href="../offer/" id="contact" class="top_link"><span class="down">What we offer</span></a></li>
  <li class="top"><a href="../pictures/" id="pictures" class="top_link"><span class="down">Multi-Media</span></a>
    <ul class="sub">
      <li><a href="/pictures/">Pictures</a></li>
      <li><a href="../rmh08/media/">Video</a></li>
    </ul>
  </li>
  <li class="top"><a href="../contact/" id="contact" class="top_link"><span class="down">Contact Us</span></a></li>
  <li class="top"><a href="../" id="home" class="top_link"><span class="down">Home</span></a></li>
</ul>  

Re: Menu manager - how to convert my old menu

Posted: Sat Nov 22, 2008 9:07 am
by Dee
Hello,

First of all this post should have gone in the "Modules/Add-Ons" (or "Layout and Design (CSS & HTML)") forum, some moderator might move this.

Second there seem to be some redundant classes and spans in your menu.
The class="sub" for sub-lists is not needed, you could use ul#nav ul { } to style the sub-lists.
The same thing with the class="top_link" for each link in a listitem of class "top"...
li.top a { } would do the same as a.top_link { }
Also the doesn't seem to be needed.

Anyhow, a very simple menu template that would create such output:

Code: Select all

{if $count > 0}
<ul id="nav">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string='<ul class="sub">' 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->depth <= 1}
<li class="top"><a href="{$node->url}" id="{$node->alias}" class="top_link"><span class="down">{$node->menutext}</span></a></li>

{else}
<li><a href="{$node->url}" id="{$node->alias}">{$node->menutext}</a></li>

{/if}

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

Try something like this (attach the "Accessibility and cross-browser tools" stylesheet to your page template to hide the accessibility navigation):

Code: Select all

{if $count > 0}
<ul id="nav">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string='<ul class="sub">' 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->current == true}
<li class="{if $node->depth <= 1}top {/if}currentpage"><h3><dfn>Current page is {$node->hierarchy}: </dfn>{$node->menutext}</h3>

{elseif $node->parent == true}
<li class="{if $node->depth <= 1}top {/if}activeparent"><a class="{if $node->depth <= 1}top_link {/if}activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}><dfn>{$node->hierarchy}: </dfn>{if $node->depth <= 1}<span class="down">{/if}{$node->menutext}{if $node->depth <= 1}</span>{/if}</a>

{elseif $node->type == 'sectionheader'}
<li class="{if $node->depth <= 1}top {/if}sectionheader">{$node->menutext}

{elseif $node->type == 'separator'}
<li class="{if $node->depth <= 1}top {/if}separator" style="list-style-type: none;"> <hr />

{else}
<li{if $node->depth <= 1} class="top"{/if}><a{if $node->depth <= 1} class="top_link"{/if} 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 != ''} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{if $node->depth <= 1}<span class="down">{/if}{$node->menutext}{if $node->depth == 0}</span>{/if}</a>

{/if}

{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
Regards,
D

Re: Menu manager - how to convert my old menu

Posted: Fri Nov 28, 2008 10:32 am
by stefsegers
volgens mij werkt t.... moet alleen de css nog een beetje aanpassen

Re: Menu manager - how to convert my old menu

Posted: Fri Nov 28, 2008 10:55 am
by Dee
stefsegers wrote: volgens mij werkt t.... moet alleen de css nog een beetje aanpassen
I think this is meant to be a reply to this thread ;)

Regards,
D