Menus: Add node->Alias to the assigned template vars

Talk about new features for CMSMS and modules.
Post Reply
Chris..S
Forum Members
Forum Members
Posts: 23
Joined: Thu Apr 20, 2006 5:23 pm

Menus: Add node->Alias to the assigned template vars

Post by Chris..S »

Hi,

I tried to work out how to add this via the forge, but couldn't see any where to add anything :?

In order to individually style some menu items it would be handy to have a string available for use as an id in the menu template.  The node->Alias value seems to fit the bill.

Its a pretty simple patch too

Code: Select all

// file: modules/MenuManager/MenuManager.module.php
// fn: FillNode
// line:  ~ 187, add
$onenode->alias = $content->Alias();
It'd be handy as well to be able to add custom fields to the news module, but I'll save that one for later.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menus: Add node->Alias to the assigned template vars

Post by Dr.CSS »

i've used,,

id}">id}" title="{$node->menutext}"{/if} href="{$node->url}">{$node->menutext}

to pic out individual menu items, such as for Imap menus.

  mark
Chris..S
Forum Members
Forum Members
Posts: 23
Joined: Thu Apr 20, 2006 5:23 pm

Re: Menus: Add node->Alias to the assigned template vars

Post by Chris..S »

Yes, that would work.  However, its not immediately apparent what the id for a given page is. 

Also, alias is visible on the options tab of the page content and its user configurable, allowing meaningful names.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menus: Add node->Alias to the assigned template vars

Post by Dr.CSS »

yep
i had to render the page then look at source to find the id number,
you just have to be careful, when i first tried the Imap thing it didn't like 2 word {$node->menutext} so i switched to id, and i've used it to add diff. color and :hover color to each menu item here www.blueoakom.com/

    mark
Chris..S
Forum Members
Forum Members
Posts: 23
Joined: Thu Apr 20, 2006 5:23 pm

Re: Menus: Add node->Alias to the assigned template vars

Post by Chris..S »

maksbud wrote: it didn't like 2 word {$node->menutext}
Yep, that why I use alias.  Its sanitised, I guess for to be ok for urls , so spaces are replaced with "_" etc.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Menus: Add node->Alias to the assigned template vars

Post by Ted »

I've added alias to the menu manager module.  It'll be in the next release.  Thanks!
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm

Re: Menus: Add node->Alias to the assigned template vars

Post by Greg »

Thank you !
Greg
Chris..S
Forum Members
Forum Members
Posts: 23
Joined: Thu Apr 20, 2006 5:23 pm

Re: Menus: Add node->Alias to the assigned template vars

Post by Chris..S »

Yes, thank you!
Post Reply

Return to “Feature ideas”