当前位置: 首页>>代码示例>>PHP>>正文


PHP Nav::begin方法代码示例

本文整理汇总了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();
开发者ID:vetoni,项目名称:toko,代码行数:9,代码来源:mini_cart.php

示例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();
开发者ID:vetoni,项目名称:toko,代码行数:13,代码来源:currencies.php

示例3:

<?php

use yii\bootstrap\Nav;
Nav::begin();
echo Nav::widget(['options' => ['class' => 'nav-pills nav-stacked'], 'encodeLabels' => false, 'items' => [['label' => '&nbsp;', '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();
开发者ID:jatuponp,项目名称:rgweb,代码行数:7,代码来源:menus.php


注:本文中的yii\bootstrap\Nav::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。