[development] Mapping aliases to menu items when having multiple aliases

Earnie Boyd earnie at users.sourceforge.net
Thu Aug 13 12:50:19 UTC 2009


Quoting Olivier Jacquet <ojacquet at jax.be>:

> I'm looking for a way to create a module that allows you to map  
> which url alias you want to associate with a specific menu entry  
> when you have more than one alias associated with a system path.  
> I've investigated this and cannot seem to find a way to implement it.
>
> The path module lets you create multiple url aliases for a node. The  
> paths some-path and other-path can both be pointed to node/1. When  
> someone creates a menu item and uses some-path to create it it's  
> converted to node/1 and it is that path that is stored in the  
> menu_links table.
>
> Then, in the case of the blocks generated by the menu module links  
> are rendered through theme_menu_item_link() which calls l() which  
> uses the first alias it finds and for the primary/secondary menu  
> it's usualy theme('links', array()) which also results in a call to  
> l(). In the former theme function you have access to the mlid but in  
> the latter you haven't. This means there is no sane way to  
> accomplish the functionality I want, I think.
>
> Does anyone have suggestions to accomplish this?
>
> The reason I want this is that I want to store context in the url  
> alias, eg. context1/about and context2/about which point to the same  
> node. This allows showing different blocks when navigating through a  
> specific context. Maybe there is another way to achieve this?
>
> Note: I'm aware of duplicate content issues etc.
>

Have you seen http://api.drupal.org/api/function/hook_menu_link_alter?

--
Earnie
-- http://r-feed.com/           -- http://for-my-kids.com/
-- http://www.4offer.biz/       -- http://give-me-an-offer.com/




More information about the development mailing list