WebsiteBaker Support (2.8.x) > Templates, Menus & Design

Showmenu 2 Bootstrap 3.3 menu code

(1/3) > >>

nibz:
The working code for a default bootstrap 3.3 navbar, so you don't have to reinvent the wheel.

When you use the menu on root.


--- Code: ---<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<?php 
$open = '<li class="[if(class=menu-current||class=menu-parent){active}] [if(class==menu-expand){dropdown}]">
[if(class==menu-expand){<a href="[url]" class="dropdown-toggle" data-toggle="dropdown">[menu_title]<b class="caret"></b></a>}
else {<a href="[url]">[menu_title]</a>}]';
show_menu2(
$aMenu          = 1,
$aStart         = SM2_ROOT, 
$aMaxLevel      = SM2_CURR+1,
$aOptions       = SM2_ALL,
$aItemOpen      = $open,
$aItemClose     = '</li>',
$aMenuOpen      = '<ul class="[if(level==0){nav navbar-nav} else {dropdown-menu}]">',
$aMenuClose     = '</ul>',
$aTopItemOpen   = false,
$aTopMenuOpen   = false
);?>
    </div>
</div>
</nav>

--- End code ---

johnbroeckaert:
 :-D
THANKS!

nibz:
@johnbroeckaert no thanks :).
Changed a little thing so if you copied the code please replace it by the new one

rumen:
I use that code, but instead of this the menu appears like this. Couldn't find why.

Gast:
please add somewhere in a HTML-area of your template / index.php this code here to show the actual level of this page - best position: somewhere in the top or in the footer of your page

Code

--- Code: ---<?php
echo "Level: ".LEVEL;
?>
--- End code ---

i'm sure, it's only a question of the level
(was this not a multi-lingual page before??)

important is this line in the code from nibz and specially the red marked part. if you're not in the root of your page tree (in level = 0), play with this, use level = 1 or what ever you have there. This Level switch is the different between your two links


--- Quote ---$aMenuOpen      = '<ul class="[if(level==0){nav navbar-nav} else {dropdown-menu}]">',
--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version