本文整理汇总了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">