How can I custom the output menu like stack in drupal 7. The main menu link appear above and the sub-menu link appear below, or some menu styles like this.
In Bartik theme, the $main_menu variable only content primary menu information but no child. So I must custom this variable or do something else to solve my problem ? Here is what i said:
<div id="main-menu" class="navigation">
<?php print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'main-menu-links',
'class' => array('links', 'clearfix'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
)); ?>
</div> <!-- /#main-menu -->
You can use drupal’s standard menu output with
parent menu itemsandsub menu items, then customize the appearance to your liking using CSS and javaScript.You can benefit from the fact of that the
sub menu itemswill appear ONLY for an active parent.Just make sure that
Mark as expandedfor ALLparent menu itemsis checked off so they don’t show by default.Update:
Don’t print out the menu in the template file. Instead, create a region in the same position then install menu block module.
This way is more flexible than yours and gives you more options to control your menu (like the depth of sub items).
Check the module documentation for more details.
Configuring menu blockssection.Hope this helps… Muhammad.