Reputation: 297
i am new to drupal and creating custom theme, i am using Main Menu but it is now showing sub-pages, i am using following code to show.
print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix', 'main-menu'))));
Please let me know what to do ? thanks in advance.
Upvotes: 3
Views: 5116
Reputation: 5577
Using this method will not render the sub items of a menu item. In order to have a menu with multiple levels you can either:
Main menu
block available under admin/structure/block
$main_menu
variable passed to the template by using a preprocess
functionIn template.php
of your theme:
function YOURTHEME_process_page(&$variables) {
$menu_tree = menu_tree_all_data('main-menu');
$variables['main_menu'] = menu_tree_output($menu_tree);
}
In your template file (page.tpl.php
)
<?php print render($main_menu); ?>
Upvotes: 5