[support] Menu positioning

Jonathan Hedstrom jhedstrom at opensourcery.com
Fri Jun 13 15:38:42 UTC 2008



John Fletcher wrote:
>
> Is there a way to instruct Drupal 6 to show a certain menu without
> actually putting the node you are viewing into that menu?
>
>  
>
> I’m using primary links as the source of secondary links and I’d like
> to instruct Drupal that “this node I’m viewing is associated with this
> menu item” so that the correct combination of primary and secondary
> links is displayed.  I can achieve this by just putting all the
> relevant nodes as third-level menu items, but then I’ve got a LOT of
> stuff in my menu (I’ve got about 700 nodes).
>
On the relevant pages, you can do the following to construct the menu
for a different path (say, for example, node/7) in template.php (in your
theme_preprocess_page() function).
 

  menu_set_active_item('node/7');
 
  // build secondary links
  $vars['secondary_links'] = menu_secondary_links();

  // reset active item
  menu_set_active_item($_GET['q']);

Cheers,

Jonathan

-- 
Jonathan Hedstrom                                     OpenSourcery
http://opensourcery.com                        Technology for Good


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.drupal.org/pipermail/support/attachments/20080613/a055a52a/attachment.pgp 


More information about the support mailing list