title: How do I dynamically set the active menu item?
body: <p>For example, I have "node/31". And I want drupal to set menu active item to "galleries/lastgallery" if node/31 is viewed. How to do it?</p>
  
  <pre><code>&lt;?php
  function custom_nodeapi (&amp;$node, $op, $a3 = NULL, $a4  = NULL){
      if ($op == 'view' &amp;&amp; $node-&gt;nid == 31) {
             ???
          }
  }
  ?&gt;
  </code></pre>
  
  <p>Updated:
  I know I can use <code>menu_set_active_item</code>. But in this case tabs (View/Edit etc. tabs) will be not displayed. I believe it should be done with <code>menu_set_active_trails</code>, or may be <code>menu_get_item</code>/<code>menu_set_item</code> somehow, but I can't figure how exactly.</p>