码迷,mamicode.com
首页 > 其他好文 > 详细

Yii2配置

时间:2015-08-29 18:42:41      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

最外层:配置文件,params

 

Yii2导航

 

<?php
            NavBar::begin([
                ‘brandLabel‘ => ‘大海‘,
                ‘brandUrl‘ => Yii::$app->homeUrl,
                ‘options‘ => [
                    ‘class‘ => ‘navbar-inverse navbar-fixed-top‘,
                ],
            ]);
            $menuItems = [
                [‘label‘ => ‘首页‘, ‘url‘ => [‘/site/index‘]],
                [‘label‘ => ‘品牌管理‘,‘url‘ => [‘/brand/index‘]],
                [‘label‘ => ‘品牌惠‘,‘url‘ => [‘/brand-benefit/index‘]],
                [‘label‘ => ‘角色管理‘,‘url‘ => [‘/role/index‘]],
                [‘label‘ => ‘权限管理‘,‘url‘ => [‘/permission/index‘]],
                [‘label‘ => ‘分类管理‘,‘url‘ => [‘/category/index‘]],
                [‘label‘ => ‘文章管理‘,‘url‘ => [‘/news/index‘]],
                [‘label‘ => ‘广告管理‘,‘url‘ => [‘/adposition/index‘]],
                [‘label‘ => ‘商铺管理‘,‘url‘ => [‘/store/index‘]],
                [‘label‘ => ‘品牌商品‘,‘url‘ => [‘/product-base/index‘]],
                [‘label‘ => ‘用户‘, ‘url‘ => [‘/user/index‘]],
            ];
            if (Yii::$app->user->isGuest) {
                $menuItems[] = [‘label‘ => ‘登录‘, ‘url‘ => [‘/site/login‘]];
            } else {
                $menuItems[] = [
                    ‘label‘ => ‘退出 (‘ . Yii::$app->user->identity->username . ‘)‘,
                    ‘url‘ => [‘/site/logout‘],
                    ‘linkOptions‘ => [‘data-method‘ => ‘post‘]
                ];
            }
            echo Nav::widget([
                ‘options‘ => [‘class‘ => ‘navbar-nav navbar-right‘],
                ‘items‘ => $menuItems,
            ]);
            NavBar::end();
        ?>

  

Yii2配置

标签:

原文地址:http://www.cnblogs.com/wangjinke/p/4769440.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!