Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes.</p> <p>I am sure there is a module do to something like that, but you could also create your own. </p> <p>There are two ways you could go about it.</p> <p>You could use <a href="http://api.drupal.org/api/function/hook_menu/6" rel="nofollow noreferrer">hook_menu()</a> to query for the items you want and return the correct menu structure. You would need to also make sure the menu cache is rebuilt on a node save using <a href="http://api.drupal.org/api/function/hook_nodeapi/6" rel="nofollow noreferrer">hook_nodeapi()</a>. <em>See henricks' comments below about why this is a bad idea</em> </p> <p>Alternitivly you could use hook_nodeapi() to add custom menu items with <a href="http://api.drupal.org/api/function/menu_link_save/6" rel="nofollow noreferrer">menu_link_save()</a>.</p> <p><strong>Edit</strong></p> <p>hook_menu should return an array of menu items, often these are pretty static however there is nothing wrong with these arrays being dynamically generated.</p> <p>So you can query the node table to get a list of nodes you want, loop through these items and dynamically create an array which contains the correct menu items. </p> <p>very roughly:</p> <pre><code>function example_menu() { $result = db_query('select * from node where ...'); // put in your own select items and where clause $menu = array(); while ($row = db_fetch_object($result)) { $menu['my_path/' . $row-&gt;nid;] = array( // See hook menu docs for what to put here. ); } return $menu; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload