码迷,mamicode.com
首页 > 编程语言 > 详细

Yii2 menu navbar nav小部件的使用示例

时间:2016-07-12 12:07:43      阅读:368      评论:0      收藏:0      [点我收藏+]

标签:

menu

Menu::widget( [
    [
        ‘label‘ => $menu[‘name‘],
        ‘url‘ => [$menu[‘route‘]],
        ‘items‘ => [
                [
                     ‘label‘ => $menu[‘name‘],
                     ‘url‘ => [$menu[‘route‘]]
            ],
            ....
        ]
    ],
    [
        ‘label‘ => $menu[‘name‘],
        ‘url‘ => [$menu[‘route‘]],
        ‘items‘ => [
                [
                     ‘label‘ => $menu[‘name‘],
                     ‘url‘ => [$menu[‘route‘]]
            ]
        ]
    ],
    ..
] );

navbar&&nav

    NavBar::begin([
        ‘brandLabel‘ => ‘My Company‘,
        ‘brandUrl‘ => Yii::$app->homeUrl,
        ‘options‘ => [
            ‘class‘ => ‘navbar-inverse navbar-fixed-top‘,
        ],
    ]);
    $menuItems = [
        [‘label‘ => ‘Home‘, ‘url‘ => [‘/site/index‘]],
        [‘label‘ => ‘About‘, ‘url‘ => [‘/site/about‘]],
        [‘label‘ => ‘Contact‘, ‘url‘ => [‘/site/contact‘]],
    ];
    echo Nav::widget([
        ‘options‘ => [‘class‘ => ‘navbar-nav navbar-right‘],
        ‘items‘ => $menuItems,
    ]);
    NavBar::end();

 

Yii2 menu navbar nav小部件的使用示例

标签:

原文地址:http://www.cnblogs.com/LoveJulin/p/5662926.html

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