本文整理匯總了PHP中common\models\Category::NavBarCategory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::NavBarCategory方法的具體用法?PHP Category::NavBarCategory怎麽用?PHP Category::NavBarCategory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common\models\Category
的用法示例。
在下文中一共展示了Category::NavBarCategory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
<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="#" style = 'color:#e7e8e9'>網易新聞</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<?php
$i = 0;
foreach (Category::NavBarCategory() as $key => $value) {
?>
<?php
if ($i == 0) {
echo "<li class='addclick active'><a href = " . Url::to(['show/index', 'NewsSearch[category_id]' => $key]) . "}> {$value} </a></li>";
} else {
//echo "<li class='addclick' data = " .$key. " ><a href = '#'> $value <span class='sr-only'>(current)</span></a></li>";
echo "<li class='addclick'><a href = " . Url::to(['show/index', 'NewsSearch[category_id]' => $key]) . "}> {$value} </a></li>";
}
$i++;
?>
<?php
}
?>
</ul>
<form class="navbar-form navbar-left" role="search">