Community Documentation

Primary links as nice menus

Last updated April 23, 2012. Created by TUc on January 15, 2008.
Edited by Heihachi88, ravi.shankar.mishra, katherined, flk. Log in to edit this page.

This post is in the issue queue related to the Nice_menus module. It could be a help to a lot of people.

Basically you can use the theme_nice_menu_primary_links function like any other theme function. You can call it directly in your page.tpl.php or add it as a variable in your template.php.

Note: Before menu will expand on mouse over, links must be added to the menu (parents with children). Be careful when adding a lot of fly out menus when close to the right side of page as they can run off the page.
To add menu links Goto: Administer > menus > primary links

-Top Menu Link (parent)
---First Child Menu Link (drop down)
-------First Child sub-Menu Link (fly out from first child)
-------First Child sub-Menu Link (fly out from first child)
-----------First Child sub-Menu Link Child (fly out from sub-Menu Link)
---Second Child Menu Link (drop down)
-------Second Child sub-Menu Link (fly out from second child)
---Third Child Menu Link (drop down)

The default direction for a primary link with children is drop down.
The children of child links will fly out to the right.

The most basic way to call it (using version 6-2.x) is to just do:

<?php
print theme('nice_menus_primary_links');
?>

<?php
print theme('nice_menus_secondary_links', 'down'); // example for secondary links as nice menus...
?>

Note that in 5.x and 6-1.x the function is:

<?php
print theme('nice_menu_primary_links');
?>

To call it using other directions:

<?php
print theme('nice_menus_primary_links', 'right');
?>

<?php
print theme('nice_menus_primary_links', 'down');
?>

Comments

In Drupal 7 you can achieve

In Drupal 7 you can achieve this by using:

<?php
print theme('nice_menus_main_menu');
?>

Very good job

This code in working perfectly in drupal 7.

Website Designer (Drupal Themer)
Extensive professionals
info@extensiveprofessionals.com

This works OK in Drupal 7 if

This works OK in Drupal 7 if you only want to use the top level menu items, but it doesn't seem to include the second level menu items.

Very helpful...nice job

alexpls very helpful...nice job.

It works for me in Drupla 7

nobody click here