Using the menu.module to maintain you primary and secondary menus

Posted by gordon on Sun, 13/02/2005 - 1:40pm

One of the things that I have been disapointed with drupal is the method of maintaining the primary and secondary links at the top of the times. At this time I think there is the standard method plus one for each theme engine. A lot of different ways to do the same thing. All these methods are pretty useless, and does allow for the ability to take the best advantage of the current web technologoes.

Drupal does however have one method that is extremely flexiable, and will be able to allow theme designers to take the best use of the current technologies. This is the menu module which is used for the navigation menu, and as I will demonstrate can be used for the primary and secondary menus.

The problem is that only theme engines that allow the execution of php code or old style native themes can do this. So the xtemplate theme engine cannot do this without modifing the engine itself.

  1. Using the admin > menu function add 2 new menus. One being the primary and the other being the secondary. Also create any menu items that you want to be displayed on the menu.
  2. Add to your theme in place of the $primary_links and $secondary_links code the following
[?php
$menu = menu_get_menu();
foreach($menu["items"][0]["children"] as $k) {
if ($menu["items"][$k]["title"] == "Primary") {
$mid = $k;
}
}
print theme('menu_tree', $mid); ?]

I really loved reading your

I really loved reading your blog. It was very well authored and easy to understand. Unlike additional blogs I have read which are really not tht good. Start a Cleaning Business

Yeah bookmaking this

Yeah bookmaking this wasn’t a bad decision great post! .

Good Job of acknowledgment

I visited this page first time and found it Very Good Job of acknowledgment and a marvelous source of info.........Thanks Admin! Reverse Phone Lookup Reverse Phone Lookup

Well I have done a bit of

Well I have done a bit of work this weekend on building updating ecommerce to use the new forms api. The store module is basically complete now. However I do need to refactor some of the methods of doing things such as the admin/store so that it can uses the new _validate() and _submit() functions to do the updating.JN0-343 | MB2-633 | HP0-P14 | 117-202 | 642-504 | 1z0-517 | 642-481 | ASC-099 | 70-682 | ST0-099

Really impressed! Everything

Really impressed! Everything is very open and very clear explanation of issues. It contains truly information. Your website is very useful. Thanks for sharing. Looking forward to more 642-647 dumps | 646-671 dumps | 70-685 dumps | 650-195 dumps | 646-230 dumps | 1z0-051 dumps | HP0-S27 dumps | 312-50 dumps | 1Y0-A05 dumps | 70-686 dumps | 70-433 dumps | 642-515 dumps | FCNSP dumps | 1Y0-A08 dumps | 642-661 dumps |

horizontal menu?

Hi: Thanks for your code. I tried it with PHPTemplate and it worked as described, but I got the menu as it would have been rendered in a block, and I would need it horizontally. I guess that I have to modify som CSS, but I don't know how. I kept the class=secondary-links tag. Thanks in advance!

I can give you some tips on

I can give you some tips on getting the wizard thing going. the old wizard api hasn't been updated for drupal 4.7 yet, and there's one patch outstanding that is still making node wizards quite hard. (node forms are the most hard-coded forms in all of drupal).MB2-868//642-384//NS0-510/70-513//70-401//350-029//70-681//FCNSA//646-230//642-741//1Y0-A08//