Hello,
I am currently using CMSMS 1.5.1 and I am trying to achieve this navigation
Home | About Us | Contact
Unfortunately, it's always displaying an extra pipe at the end
Home | About Us | Contact |
Is there a way to do this? Like {$node->last_item}?
Thanks in advance!
How to get the last item in the menu
-
- New Member
- Posts: 3
- Joined: Wed Apr 01, 2009 3:24 pm
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: How to get the last item in the menu
Read the smarty manual.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: How to get the last item in the menu
How about just searching the forum. I have seen this request posted and answer multiple times within the last couple days.
-
- New Member
- Posts: 3
- Joined: Wed Apr 01, 2009 3:24 pm
Re: How to get the last item in the menu
I am not really sure what keyword to use to search this. The admin could put it in as a sticky if you have seen it asked a couple of times.
-
- New Member
- Posts: 3
- Joined: Wed Apr 01, 2009 3:24 pm
Re: How to get the last item in the menu
I read the smarty manual and got it to work. Here is the code
Do you think there could be a better solution to this?
Code: Select all
{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}
{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{foreach from=$nodelist item=node name=foo}
{if $node->depth > $node->prevdepth}
{repeat string="<ul class='unli'>" 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 class="menuactive menuparent">
<a class="menuactive menuparent" {elseif $node->current == true}
<li class="menuactive">
<a class="menuactive" {elseif $node->haschildren == true}
<li class="menuparent">
<a class="menuparent" {elseif $node->type == 'sectionheader'}
<li class="sectionheader"><span>{$node->menutext}</span> {elseif $node->type == 'separator'}
<li style="list-style-type: none;"> <hr class="separator" />{else}
<li>
<a {/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
href="{$node->url}"><span>{$node->menutext}</span></a>
{if $smarty.foreach.foo.last == 0} |
{/if}
{elseif $node->type == 'sectionheader'}
><span>{$node->menutext}</span></a>
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}
</li>
</ul>
<div class="clearb"></div>
</div>
{/if}