Page 1 of 1

Need help understanding Menu Manager syntax

Posted: Thu Mar 26, 2009 2:17 am
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!!

Re: Need help understanding Menu Manager syntax

Posted: Mon Aug 24, 2009 9:11 pm
by The Wizl
Same here. Could someone please make this example understandeably for me/us who cannot code.

Thanks

Re: Need help understanding Menu Manager syntax

Posted: Sun Aug 30, 2009 8:53 pm
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