how to add attributed to nav bootstrap menues

edited January 2016 in Share
Hi
I am trying to work with nav section and newly discovering it
now i want to generate an menu like following :

''
With the code :

<?php echo $nav_arr = fuel_nav(array('depth'=>4
,'render_type' => 'basic'
, 'group_id' => 1
,'container_tag_attrs' => array('style' => '')
,'container_tag_class' => 'nav navbar-nav menuright'
,'order' => 'precedence'
,'subcontainer_tag_class'=>array('dropdown-menu', 'styles' => array(0 => array(1 => 'dropdown')))
)); ?>

but cant getting the way to do the changes specially in this section


can one please help me out ????please view the source code of those list

Comments

  • edited 3:44AM
    What is the menu configuration (either at fuel/application/views/_variables/nav.php or in the CMS)?
  • edited 3:44AM
    it is not in nav.php ($nav = array();)
    it is form the CMS
  • edited 3:44AM
    What does it look like if you download the navigation from the CMS (there is download button in the list view)?
  • edited 3:44AM
    This code is generated in downloaded php
    $nav['home'] = array('label' => 'Home');
    $nav['about-us'] = array('label' => 'about us');
    $nav['product'] = array('label' => 'Product', 'location' => 'product-1', 'attributes' => 'product-1');
    $nav['Product-Support'] = array('label' => 'Product Support');
    $nav['Contact'] = array('label' => 'Contact');
    $nav['product-1'] = array('label' => 'Product 1', 'parent_id' => 'product');
    $nav['product-2'] = array('label' => 'product-2', 'parent_id' => 'product');
  • edited 3:44AM
    I think what you may be missing is the "styles" parameter for the surrounding li element for products which can be done as follows:

    <?php echo $nav_arr = fuel_nav(array('depth'=>4 ,'render_type' => 'basic' , 'group_id' => 1 ,'container_tag_attrs' => array('style' => '') ,'container_tag_class' => 'nav navbar-nav menuright' ,'order' => 'precedence' ,'subcontainer_tag_class'=>array('dropdown-menu', 'styles' => array(0 => array(1 => 'dropdown'))) ,'styles'=> array(0 => array(2 => 'dropdown')) )); ?>

    Also, I updated the nav to fix attributes on the item as well as the label to include the with:
    $nav['home'] = array('label' => 'Home'); $nav['about-us'] = array('label' => 'about us'); $nav['product'] = array('label' => 'Product <span class="caret"></span>', 'location' => 'product-1', 'attributes' => 'class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"',); $nav['Product-Support'] = array('label' => 'Product Support'); $nav['Contact'] = array('label' => 'Contact'); $nav['product-1'] = array('label' => 'Product 1', 'parent_id' => 'product'); $nav['product-2'] = array('label' => 'product-2', 'parent_id' => 'product');
  • There was no response for this fix, It will always be better to give feedback so as to know if a particular hack fixed an issue or not.

Sign In or Register to comment.