本文整理汇总了PHP中yii\bootstrap\Nav::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP Nav::begin方法的具体用法?PHP Nav::begin怎么用?PHP Nav::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Nav
的用法示例。
在下文中一共展示了Nav::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
use app\helpers\CurrencyHelper;
use app\modules\checkout\models\Cart;
use yii\bootstrap\Nav;
use yii\helpers\Url;
$cart = Cart::get();
Nav::begin(['encodeLabels' => false, 'items' => [['label' => "<strong>" . CurrencyHelper::format($cart->total) . "</strong> ( {$cart->totalCount} )", 'url' => null], ['label' => '<i class="glyphicon glyphicon-shopping-cart"></i>', 'active' => true, 'url' => Url::to(['/checkout/cart/index'])]], 'options' => ['class' => 'mini-cart navbar-nav pull-right']]);
Nav::end();
示例2:
<?php
use app\helpers\CurrencyHelper;
use yii\bootstrap\Nav;
use yii\helpers\Url;
$all = CurrencyHelper::all();
$current = CurrencyHelper::current()->code;
$items = [];
foreach ($all as $currency) {
$items[] = ['label' => $currency->symbol, 'url' => '#', 'active' => $currency->code == $current, 'linkOptions' => ['data-id' => $currency->code]];
}
Nav::begin(['encodeLabels' => false, 'items' => $items, 'options' => ['class' => 'currencies navbar-nav pull-right', 'data-action' => Url::to(['/shop/set-currency'])]]);
Nav::end();
示例3:
<?php
use yii\bootstrap\Nav;
Nav::begin();
echo Nav::widget(['options' => ['class' => 'nav-pills nav-stacked'], 'encodeLabels' => false, 'items' => [['label' => ' ', 'options' => ['class' => 'nav-header disabled'], 'visible' => !Yii::$app->user->isGuest], ['label' => '<i class="glyphicon glyphicon-pencil"></i> เขียนบทความ', 'url' => ['/admin/article/update'], 'visible' => Yii::$app->user->can('Editor')], ['label' => '<i class="glyphicon glyphicon-book"></i> บริหารบทความ', 'url' => ['/admin/article/index'], 'visible' => Yii::$app->user->can('Editor')], ['label' => '<i class="glyphicon glyphicon-book"></i> บริหารเอกสารดาวน์โหลด', 'url' => ['/admin/document/index'], 'active' => Yii::$app->controller->id == 'document', 'visible' => Yii::$app->user->can('Editor')], ['label' => '<i class="glyphicon glyphicon-folder-open"></i> บริหารหมวดหมู่บทความ', 'url' => ['/admin/categories/index'], 'active' => Yii::$app->controller->id == 'categories', 'visible' => Yii::$app->user->can('Authority')], ['label' => '<i class="glyphicon glyphicon-tasks"></i> บริหารเมนูเว็บไซต์', 'url' => ['/admin/menus/index'], 'active' => Yii::$app->controller->id == 'menus', 'visible' => Yii::$app->user->can('Editor')], ['label' => '<i class="glyphicon glyphicon-picture"></i> บริหารภาพสไลด์', 'url' => ['/admin/slider/index'], 'active' => Yii::$app->controller->id == 'slider', 'visible' => Yii::$app->user->can('Administrator')], ['label' => '<i class="glyphicon glyphicon-picture"></i> บริหารภาพกิจกรรม', 'url' => ['/admin/gallery/index'], 'active' => Yii::$app->controller->id == 'gallery', 'visible' => Yii::$app->user->can('Administrator')], ['label' => '<i class="glyphicon glyphicon-user"></i> บริหารข้อมูลผู้ใช้', 'url' => ['/admin/user/index'], 'active' => Yii::$app->controller->id == 'user', 'visible' => Yii::$app->user->can('Authority')], ['label' => '<i class="glyphicon glyphicon-stats"></i> สถิติการเยื่ยมชมเว็บไซต์', 'url' => ['/admin/stat/index'], 'active' => Yii::$app->controller->id == 'stat', 'visible' => !Yii::$app->user->isGuest]]]);
Nav::end();
echo '<br/>' . Yii::powered() . ': ' . Yii::getVersion();