I am using Drupal 7.9. I need to display main menu with sub-menu.
print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => '',
'class' => array('menu'),),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),)
);
That is the code I have used, but it does not show sub-menu items.
Then i have also tried following code :
if ($main_menu){
$pid = variable_get('menu_main_links_source', 'main-menu');
$tree = menu_tree($pid);
$tree = str_replace(' class="menu"', '', $tree);
$main_menu = drupal_render($tree);
}
else {
$main_menu = FALSE;
}
if ($main_menu): print $main_menu;
endif;
Even it does not display sub-menu.
Does anybody know a solution?