Skip to content

Instantly share code, notes, and snippets.

@umidjons
Created February 24, 2014 08:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umidjons/9183805 to your computer and use it in GitHub Desktop.
Save umidjons/9183805 to your computer and use it in GitHub Desktop.
Use bootstrap menu in Yii with CMenu
<nav class="navbar navbar-default top-navbar" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex-collapse">
<span class="sr-only">Expand the menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navbar-ex-collapse">
<?php
// @TODO: normalize items & apply friendly urls
$this->widget( 'zii.widgets.CMenu', [
'items' => [
[ 'label' => 'Home', 'url' => [ 'site/index' ] ],
[ 'label' => 'About', 'url' => [ 'site/about' ] ],
[ 'label' => 'Documentation', 'url' => [ 'site/docs' ] ],
[ 'label' => 'Tutorials', 'url' => [ 'site/help' ] ],
[ 'label' => 'FAQ', 'url' => [ 'site/faq' ] ],
],
'activeCssClass' => 'active',
'htmlOptions' => [ 'class' => 'nav navbar-nav' ],
] );
?>
</div>
</nav>
@surfer190
Copy link

How do you add the search form?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment