• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS made Simple Czech Site Zur deutschsprachigen Supportseite Site francophone Sitio en Castellano CMSMS - Magyarország CMSMS -  ???????
Pages: [1]
  Print  
Author Topic: How to get the last item in the menu  (Read 379 times)
0 Members and 1 Guest are viewing this topic.
blue_francis14
New Member


Karma: 0
Offline Offline

Posts: 3


« on: 16 Jul 2009, 04:06 »

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!
Logged
calguy1000
CMS GURU - 2nd Tier Support.
Dev Team Member
Power Poster
*****

Karma: 162
Offline Offline

Posts: 5108

Gravatar

Second Tier support


WWW
« Reply #1 on: 16 Jul 2009, 09:42 »

Read the smarty manual.
Logged

Follow me on twitter
For quality help follow these instructions:
a) Think about the problem for an hour
b) research the problem for an hour
c) spend 1/2 an hour explaining it and providing as much information as you can muster
(too much information is okay, not enough information may get your question ignored).
--
if you can't bother explaining your problem well, why should we bother helping with it.
----------------
Don't make me angry..... you won't like me when I'm angry....
ajprog
Dev Team Member
Power Poster
*****

Karma: 14
Online Online

Posts: 632


« Reply #2 on: 16 Jul 2009, 10:31 »

How about just searching the forum. I have seen this request posted and answer multiple times within the last couple days.
Logged
blue_francis14
New Member


Karma: 0
Offline Offline

Posts: 3


« Reply #3 on: 17 Jul 2009, 00:20 »

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.
Logged
blue_francis14
New Member


Karma: 0
Offline Offline

Posts: 3


« Reply #4 on: 17 Jul 2009, 01:00 »

I read the smarty manual and got it to work. Here is the code

Code:
{* 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}

Do you think there could be a better solution to this?
Logged
Pages: [1]
  Print  
 
Jump to: