Menu Template, display parent in the subnavigation. [not solved]
Posted: Wed Aug 22, 2007 12:19 am
ok, Hi all!
I've been using CMSMS for a while now and I'm redesigning my site. It's all working fine btw and I want to begin to thank the CMSMS developers.
So my issue is maybe that I've been staring at the code for so long, I don't know what it is but here's what I want to achieve:
My menu template is a 2 level navigation, that is childs are displayed when I hover the parent etc. and it's working very well.
The {if !$node-haschildren} clause is for CSS purposes (I need a inside every root )
So what this code would output is:
So basically what I have is a pretty basic CSS hover menu. What I'm trying to do is getting the parent link on top in the subnavigation; if the parent has a child;
like so:
Heim
Um okkur
Um okkur
Sagan
Opnunartímar
Hafðu Samband
Vörulisti
Vörulisti
Dyrasímar - kerfi
Hótel- & heimilisvörur
Raflagnaefni
Lampar og ljósaskilti
Ljósaperur
Töfluefni
Þjónusta
Þjónusta
Rafverktakar
Greinar
Greinar
Til varnar þjófum
Hafðu samband
Do you get the idea? I need a template that lets every parent have a inside (even if it's empty), and puts the parent item also in the subnavigation at top.
Can anyone here help me solve the problem?
I've been using CMSMS for a while now and I'm redesigning my site. It's all working fine btw and I want to begin to thank the CMSMS developers.
So my issue is maybe that I've been staring at the code for so long, I don't know what it is but here's what I want to achieve:
My menu template is a 2 level navigation, that is childs are displayed when I hover the parent etc. and it's working very well.
Code: Select all
<div id="navigation">
{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->current == true or $node->parent == true}
<li class="active">
<a href="{$node->url}"
{if $node->target ne ""}
target="{$node->target}"{/if}>{$node->menutext}</a>{if $node->depth == 1}{if !$node->haschildren}
<ul></ul>
{/if}{/if}
{else}
<li><a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>{if $node->depth == 1}{if !$node->haschildren}
<ul></ul>
{/if}{/if}
{if{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-2}</li>
</ul>
{/if}
</div>
So what this code would output is:
Code: Select all
<div id="navigation">
<ul>
<li class="active"><a href="http://rafsol.is/index.php/heim" >Heim</a><ul></ul>
</li>
<li><a href="http://rafsol.is/index.php/um_okkur">Um okkur</a><ul>
<li><a href="http://rafsol.is/index.php/um_okkur/sagan">Sagan</a></li>
<li><a href="http://rafsol.is/index.php/um_okkur/opnunartimar">Opnunartímar</a></li>
<li><a href="http://rafsol.is/index.php/um_okkur/hafdu_samband">Hafðu Samband</a>
</li></ul>
</li>
<li><a href="http://rafsol.is/index.php/vorulisti">Vörulisti</a><ul>
<li><a href="http://rafsol.is/index.php/vorulisti/dyrasimakerfi">Dyrasímar - kerfi</a></li>
<li><a href="http://rafsol.is/index.php/vorulisti/hotelvorur">Hótel- & heimilisvörur</a></li>
<li><a href="http://rafsol.is/index.php/vorulisti/raflagnaefni">Raflagnaefni</a></li>
<li><a href="http://rafsol.is/index.php/vorulisti/lampar_og_ljosaskilti">Lampar og ljósaskilti</a></li>
<li><a href="http://rafsol.is/index.php/vorulisti/ljosaperur">Ljósaperur</a></li>
<li><a href="http://rafsol.is/index.php/vorulisti/tofluefni">Töfluefni</a>
</li></ul>
</li>
<li><a href="http://rafsol.is/index.php/thjonusta">Þjónusta</a><ul>
<li><a href="http://rafsol.is/index.php/thjonusta/fasdfa">Rafverktakar</a>
</li></ul>
</li>
<li><a href="http://rafsol.is/index.php/frodleikur">Greinar</a><ul>
<li><a href="http://rafsol.is/index.php/frodleikur/tilvarnarthjofum">Til varnar þjófum</a>
</li></ul>
</li>
<li><a href="http://www.rafsol.is/index.php/um_okkur/hafdu_samband">Hafðu samband</a><ul></ul>
</li>
</ul>
</div>
like so:
Heim
Um okkur
Um okkur
Sagan
Opnunartímar
Hafðu Samband
Vörulisti
Vörulisti
Dyrasímar - kerfi
Hótel- & heimilisvörur
Raflagnaefni
Lampar og ljósaskilti
Ljósaperur
Töfluefni
Þjónusta
Þjónusta
Rafverktakar
Greinar
Greinar
Til varnar þjófum
Hafðu samband
Do you get the idea? I need a template that lets every parent have a inside (even if it's empty), and puts the parent item also in the subnavigation at top.
Can anyone here help me solve the problem?