當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。