[support] Menu positioning

John Fletcher net at twoedged.org
Sun Jul 6 05:13:51 UTC 2008


Jonathan,
 
Thanks a lot for the below tip.  It's a month old now but finally I got
around to doing it - and it worked!  The only trick was that I had to store
$_GET['q'] in a variable before changing the active item else it wouldn't
change back correctly.  I now wrote a bit of complicated code to get all the
right secondary links menus appearing at the right time.
 
The only further thing that would be great is to be able to set the desired
menu items as "active" in primary and secondary links.  I've seen a few
people talking about how to do this on drupal.org but it inevitably involves
regexp string matching... yuk... and there are different techniques anyway.
Does anyone know the "best way" to do this in D6?
 
By the way Jonathan, you appear to cryptographically sign your messages and
I find that with MS lookOut (in digest mode - all messages come as
attachments to one message) I can't read your messages.  I had to go to the
online list archive to read your response.  Not sure if this is just an
Outlook issue but anyway thought you should know.
 
Regards,
John
 
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 --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080706/b3f0f412/attachment.htm 


More information about the support mailing list