Simple Vertical Menu
Posted: Wed Jun 11, 2008 11:31 pm
Hi i've been trying to figure this out for a while now but there always seems to be problems. Would anyone be able to help me ? I wanted to create a simple vertical text menu which displays child while you are on the parent. I also wanted the child to be indented slightly. This code below seemed to work and it did in FireFox but then when i came to test it in IE7 it messes up mainly because of the div i'm using to indent the child, i've checked my div nesting and it all seems fine but no matter what i do IE7 takes that div close tag and cuts off the wrong divs before it. Does anyone know of a different way to create the small indent ? Or maybe a way that will work in both browsers ? Thanks in advance !
Code: Select all
{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}<div style="padding-left:20px">
{elseif $node->depth < $node->prevdepth}</div>
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->current == true}
<li><a href="{$node->url}" class="hover" {if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>
{elseif $node->parent == true}
<li class="activeparent"><a class="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}>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext}
{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />
{else}
<li><a 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}>{$node->menutext}</a>
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}