I was wondering if it was possible in CMSMS to have a lastpage class similar to a currentpage class? If so, how is it done?
I want to have the last page in the horizontal menu a different colour as it is for a Members Only area and I want it to stand out a bit.
Thanks
Navigation - class for "last page"
Re: Navigation - class for "last page"
In menu manager find:
{foreach from=$nodelist item=node}
Replace with this:
{foreach from=$nodelist item=node name=foo}
{if $smarty.foreach.foo.last}
your classes
{else}
-R
{foreach from=$nodelist item=node}
Replace with this:
{foreach from=$nodelist item=node name=foo}
{if $smarty.foreach.foo.last}
your classes
{else}
-R
Re: Navigation - class for "last page"
Thank you Recon I'll give that a go.
Re: Navigation - class for "last page"
...or you can set that last page to -not show on menu- and on template create classed link to your page 
-R

-R
Re: Navigation - class for "last page"
That's a clever idea, Recon! Will try that also
Thanks
Thanks

Re: Navigation - class for "last page"
Don't think I did this correctly: in templateRecon wrote:...or you can set that last page to -not show on menu- and on template create classed link to your page![]()
<div class="nav">
{menu number_of_levels="1" template="minimal_menu.tpl"}
<div class="lastpage></div>
</div>
In CSS: .nav .lastpage {color: red;}
Do you mind showing me the correct way?
Thanks
Re: Navigation - class for "last page"
Example for NCleanBlue template:
Go menu manager -> add template and name it "test"
Paste this and save:
Go to templates -> NCleanBlue
replace menu-tag with this:
Go to stylesheets -> Layout: NCleanBlue
paste this:
last page's text is colored red
-R
Go menu manager -> add template and name it "test"
Paste this and save:
Code: Select all
{assign var='number_of_levels' value=10000}
{if isset($menuparams.number_of_levels)}
{assign var='number_of_levels' value=$menuparams.number_of_levels}
{/if}
{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><li class="separator once" style="list-style-type: none;"> </li></ul>' times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or $node->current == true}
{assign var='classes' value='menuactive'}
{if $node->parent == true}
{assign var='classes' value='menuactive menuparent'}
{/if}
{if $node->children_exist == true and $node->depth < $number_of_levels}
{assign var='classes' value=$classes|cat:' parent'}
{/if}
{if $node->type == 'sectionheader'}
<li class="{$classes}"><a class="{$classes}"><span class="sectionheader">{$node->menutext}</span></a>
{else}
<li class="{$classes}"><a class="{$classes}"
{/if}
{elseif $node->type == 'sectionheader' and $node->haschildren == true}
<li><a ><span class="sectionheader">{$node->menutext}</span></a>
{elseif $node->type == 'sectionheader'}
<li><a ><span class="sectionheader">{$node->menutext}</span></a>
{elseif $node->type == 'separator'}
<li style="list-style-type: none;"> <hr class="menu_separator" />
{elseif $node->children_exist == true and $node->depth < $number_of_levels and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="menuparent"><a class="menuparent"
{else}
<li {if $smarty.foreach.foo.last}class="test" {else}{/if}>
<a
{/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
{if $node->target}target="{$node->target}" {/if}
href="{$node->url}"><span>{$node->menutext}</span></a>
{/if}
{/foreach}
{repeat string='</li><li class="separator once" style="list-style-type: none;"> </li></ul>' times=$node->depth-1}
</li>
</ul>
<div class="clearb"></div>
</div>
{/if}
Go to templates -> NCleanBlue
replace menu-tag with this:
Code: Select all
{menu loadprops=0 template='test' number_of_levels="1" }
Go to stylesheets -> Layout: NCleanBlue
paste this:
Code: Select all
.test a span{
color:red;
}
-R
Re: Navigation - class for "last page"
Thank you so much Recon for taking the time.
[Later] OK - I used the template above, made it the default, and did everything else as mentioned but it still doesn't work.
I came across this also ( from Goran Ilic) but not sure what
"yourMenu Manager code" means.
{foreach from=$nodelist item=node name=menuitem} <!-- your MenuManager code --> <a href="{$node->url}"{if $smarty.foreach.menuitem.last} class="last-menu-item"{/if}>{$node->menutext}</a> {/foreach}
[Later] OK - I used the template above, made it the default, and did everything else as mentioned but it still doesn't work.
I came across this also ( from Goran Ilic) but not sure what
"yourMenu Manager code" means.
{foreach from=$nodelist item=node name=menuitem} <!-- your MenuManager code --> <a href="{$node->url}"{if $smarty.foreach.menuitem.last} class="last-menu-item"{/if}>{$node->menutext}</a> {/foreach}