Loading a Menu, and Theming the Links in Two Lines of Code

When creating a menu [ admin/build/menu/add ] there's a field for "Menu name". We use that value to load whatever array of menu links we want. In this example, we're using "secondary-links" which comes default on most drupal installs.


= menu_navigation_links("secondary-links");
theme('links', $menu);


This is a particularly nice technique to use along with hook_preprocessor_page. You can easily send your menu links to your page.tpl.php file from a module like this:

function hook_preprocess_page(&$vars) {
$menu = menu_navigation_links("secondary-links");
$vars['footer_menu_primary'] = theme('links', $menu);

The array return by menu_navigation_links is also flexible, giving you both a title and an href. So really, you can do whatever you want with these links once you grab em. This technique is far better than say, hard coding links in a function like many of us did in the dark days of drupal past.