Need help understanding Menu Manager syntax

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Need help understanding Menu Manager syntax

Post by jmcgin51 »

Hello all,

I am trying to create a custom (semi-custom?) horizontal CSS/image menu, as described here:
http://wiki.cmsmadesimple.org/index.php ... nu_Styling

I'm running into several issues, and I think the biggest one is that I don't understand the menu template syntax.  I have read and reread the author's comments, the Menu Manager help, and have searched the forum, but can't seem to get my head around a couple of things.  For example, here is the code that the author says should be placed into the menu template:

Code: Select all

{if $count > 0}
{foreach from=$nodelist item=node}

{if $node->current == true}
<div class="{$node->menutext|replace:'Home':'home2'|replace:'Contact':'contact2'} nav">
<a href="{if $node->id == 15}/{else}{$node->url}{/if}"{if $node->target ne ""} target="{$node->target}"{/if}></a></div>

{elseif $node->parent == true}
<div class="{$node->menutext|replace:'Home':'home2'|replace:'Contact':'contact2'} nav">
<a href="{if $node->id == 15}/{else}{$node->url}{/if}"{if $node->target ne ""} target="{$node->target}"{/if}></a></div>

{else}
<div class="{$node->menutext|replace:'Home':'home'|replace:'Contact':'contact'} nav">
<a href="{if $node->id == 15}/{else}{$node->url}{/if}"{if $node->target ne ""} target="{$node->target}"{/if}></a></div>
{/if}

{/foreach}
{/if}
What does this line do:

Code: Select all

{$node->menutext|replace:'Home':'home2'|replace:'Contact':'contact2'}
I can tell that it replaces the menu text with the CSS class, but why does it have two "replace" commands?  Is it a "first and last" thing?  So if my first page were "Main" and my last page were "Donations", I would rewrite the line as:

Code: Select all

{$node->menutext|replace:'Main':'main2'|replace:'Donations':'donations2'}
??

Also, what is the significance of this line:

Code: Select all

{if $node->id == 15}
Do I need to change the node id to match the id of my actual page, or is there something magical about a node id of 15 that somehow makes everything work right?

I'll probably have more questions, but if someone can get me pointed in the right direction, I think I can make progress.  Thanks in advance!!
The Wizl
New Member
New Member
Posts: 9
Joined: Mon Jun 22, 2009 2:55 pm

Re: Need help understanding Menu Manager syntax

Post by The Wizl »

Same here. Could someone please make this example understandeably for me/us who cannot code.

Thanks
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Need help understanding Menu Manager syntax

Post by Dr.CSS »

There is no reason to go thru all those hoops to get an image menu, just uses css, you can change the menu to include page alias as a class or page ID(but that will need a  letter in front of it as IDs don't use numbers) to target the menu item...

Or you can use the page image...

http://mit-computers.com/index.php/how- ... types.html
Post Reply

Return to “Layout and Design (CSS & HTML)”