1

For a Drupal 7 website, I need to have 2 types of menus: 1 menu with a list of countries, each menu entry pointing to a given node. For each country page, I need to display a 'characteristics' menu, with fixed items (e.g. population, incomes), but (of course) the targeted nodes have to be changed in function of the current country. (Clicking on the 'characteristics' menu entries opens a page which is different for each country.)

Is there a module for that in Drupal 7, or a way to do that programmatically?

2
  • What is it that makes one node have 5 items in the characteristics menu and another node only have 3 menu items for example? Commented Jul 29, 2013 at 11:50
  • In principle, there should be always the same number of items in the menus, only the link associated to the menu items would change for each page. Commented Jul 30, 2013 at 12:48

1 Answer 1

0

I found an answer to my question: the best is to use a programmatic approach by using the l() function that is available anywhere within a Drupal installation. It accepts three arguments:

  • $text: The text that will be visible to users for your link
  • $path: The URL that the link will go to when clicked.
  • $options: An associative array which allows to set additional parameters to further customize the link with CSS classes etc…

A good introduction is found here: http://www.pixelclever.com/how-and-why-use-l-function-create-links-drupal-programming. This function can be used in the template files, or directly from a node body.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.