Page 1 of 1

[SOLVED] Menu To Display Page Links By ID

Posted: Tue Sep 04, 2007 7:45 pm
by passtheammo
Hi Guys,

I have a single tier list of pages. In my design, I have a upper page menu, and a middle page menu.

How can I get the upper page menu to display only links to pages by their ID of 1,2,3,4,5 

and the middle page menu to display links to pages by their ID of 6,7,8,9,10.

I've looked at the menu manager help page, and tried searching the forums for a similar request.

Thanks for your help.  :)

EDIT: I was planning on hard coding into the template, but I decided that I wanted to use the class="active" feature, which is why I'm trying to accomplish this.

Re: Menu To Display Page Links By ID

Posted: Tue Sep 04, 2007 8:14 pm
by Dr.CSS
Any particular reason for using the ID and not the alias or putting the menus/page structure in such a way as to only show certain pages under top level in top menu and items under second set shown in side menu, this way you don't need to know IDs or alias'...

1..Home
2..secondpage
3..thirdpage
4..etc.
5..etc.
6..Sectionheader  set not shown in menu
6.1..page
6.2..page
6.3..page
6.4..etc.

{menu}  first tag only shows pages 1...5
{menu start_element="6.1" show_root_siblings="1"} shows 6.1 and all siblings 6.2, 6.3, etc....

Re: Menu To Display Page Links By ID

Posted: Tue Sep 04, 2007 8:24 pm
by alby
passtheammo wrote: How can I get the upper page menu to display only links to pages by their ID of 1,2,3,4,5 
and the middle page menu to display links to pages by their ID of 6,7,8,9,10.
1. For very low number of pages you can use: items="contact,home,etc,foo"

2. In menu template add this code (this is an example, change for match your code):
First template, even only:

{foreach from=$nodelist item=node}
  {if $node->id is even}
.............
.............
  {/if}
{/foreach}


Seconf template, odd only:

{foreach from=$nodelist item=node}
  {if $node->id is odd}
.............
.............
  {/if}
{/foreach}

Alby

Re: Menu To Display Page Links By ID

Posted: Wed Sep 05, 2007 5:57 pm
by passtheammo
Thanks for your attention, guys.  I'm still kinda new to CMSMS, so I'm learning all the tokens to use etc.

This is my topnav template.

Code: Select all

{if $count > 0}
{$node->depth = 2}
<ul id="nav">

{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}
<li><a href="{$node->url}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>
{elseif $node->parent == true && $node->depth == 1}
<li class="activeparent"> <a href="{$node->url}" class="activeparent"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>
{elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext}
{elseif $node->type == 'separator'}
<li style="list-style-type: none;"> <hr class="separator" />
{else}
<li><a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}


so I set the pages up in the tier structure you suggested.


TOPNAV
1.1
1.2
1.3
1.4
1.5
1.6

MIDNAV
2.1
2.2
2.3
2.4

And in my global template I put in this call. 

div id="topnav"
{menu start_element="1.1" show_root_siblings="1"}


div id="midnav"
{menu start_element="2.1" show_root_siblings="1"}


The problem I'm getting is that CMSMS now wraps the current page in H3 tags, as well as the page heirarchy  (1.2)  in front of the page menu text.

Example

1.1 HOME    1.2 ABOUT  1.3 CONTACT


I suppose I could use display: none, to hide the heirarchy, as they are wrapped with a DFN tag.  And style the nav's H3 to appear the same as the rest of the links... but I would think there is a better way to do it.


Also, I use the breadcrumb feature. and it is showing the dummy page I used to put the sub pages in.

Example
Home / Top Section / About Us


The TOPNAV template I posted above, cuts out alot of the additional info that I don't want. Is there a way I can modify it so that it only displays specific pages such as was suggested  "item=Home, About, Contact" ?

Thanks again for your help guys. So far CMSMS has been great!

Re: Menu To Display Page Links By ID

Posted: Wed Sep 05, 2007 6:08 pm
by Dr.CSS
Did you set "Topnav/topsection" as not shown in menu, go to the edit page for those and look at Options to find check box to uncheck to not show in menu, should take it out of the crumbs...

Look thru the cross browser style sheet to find the dfn call that will hide them...

The template you posted has a name?... your menu tags you posted make no mention of a template call so you are getting the default template...

{menu template="thenameofyourtemplate" start_element="1.1" show_root_siblings="1"} no .tpl on the end of the template call, unless you use a default template...

Re: Menu To Display Page Links By ID

Posted: Wed Sep 05, 2007 7:45 pm
by passtheammo
Thank you for help, friend. You have helped me resolve this.

Re: [SOLVED] Menu To Display Page Links By ID

Posted: Wed Sep 05, 2007 8:18 pm
by Dr.CSS
Your welcome, trying to help in my own small way...