Download & Extend

Secondary links confusion

Project:Zen
Version:6.x-2.1
Component:PHP code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I have been wrestling with this problem for most of the day and so far it has defeated me but at least I think I can explain exactly what the problem is. I really would appreciate any suggestions as to where to go from here.

In summary,the problem is that I want the child elements of my main menu elements to appear as secondary links in the first sidebar. No matter what I do, they appear in the footer section.

I have Drupal 6 and I am using the Zen theme and I have created my sub-theme in the way described,and it seems to be working correctly.

In the menus administration system under settings, you can set the source for secondary links to be the primary links. According to the help text, that will cause the children of the active primary link to be displayed as secondary links. That is what I want so I have set it that way. As expected, the links do appear as secondary links in the footer section and I was happy with that until the client asked me to put the secondary links into the first sidebar.

In the blocks configuration I simply put the secondary links into the first sidebar. But the secondary links remained in the footer section.

I then added a couple of links to the secondary links menu. That menu had no links of its own because in fact the source for its links is actually the primary links.

Now a secondary links menu appears in the first sidebar with the two links I created, so that's progress, but the child links of the current element in the primary links menu still remain in the footer. It is as if there are two menus now claiming to be the secondary links menu.

I notice in my theme's page.tpl.php file that the code that prints the footer prints a secondary links menu if $secondary_links is set. OK so I deduce from that that the reason why my child links are appearing in the footer is because $secondary_links must be set to hold those links.

I also notice from page.tpl.php that the first sidebar is just printed directly, so it is assembled elsewhere before we get to page.tpl.php, and this is where I am defeated because I haven't as yet found where that happens.

I'm guessing that somehow the first sidebar is formed before the menuing system creates the secondary links based on the current menu selection. If that is happening then that would explain why I do have a secondary links menu in the first sidebar where it needs to be, as well as another secondary links menu in the footer.

So can anyone tell me how to fix this or at least head me in the right direction to do it? I am still quite new to Drupal and this is only my second site but I feel sure I could solve the problem if I could just hack in the right place. I'm thinking that given the secondary links do exist correctly at the time we hit page.tpl.php, if I could just call the function that generates the first sidebar from within page.tpl.php just before the sidebar is printed, it might build it correctly and at least I could get out of jail until I find a better solution.

thank you.

Comments

#1

The primary links and secondary links are hard coded in page.tpl so their location is set there (unless moved in page.tpl). These are provided as easy out of the box menus, and can be disabled from the theme’s settings page. Note that there are also blocks for primary links and secondary links that are disabled by default, that could be placed in a region. It’s true, this is a source of confusion.

For what you describe (child menu items of a main menu to appear in a sidebar), I *highly* recommend http://drupal.org/project/menu_block (also by the Zen maintainer) that lets you have any level of your menu tree in a different region.

nobody click here