安装AdminLTE

官网地址:https://almsaeedstudio.com/ , 可以预览模板:https://almsaeedstudio.com/themes/AdminLTE/index2.html ,也可以直接下载归档文件 AdminLTE-2.3.7.zip (7.0 MB)。

如果要在yii2项目中安装AdminLTE模板,它实际作为yii2项目的extension,在github上面的项目中有安装说明,地址https://github.com/dmstr/yii2-adminlte-asset。

Installation
The preferred way to install this extension is through composer.
To install AdminLTE v2 run:
     php composer.phar require dmstr/yii2-adminlte-asset "2.*"
To install AdminLTE v1 run:
     php composer.phar require dmstr/yii2-adminlte-asset "1.*"
Customization
  • Copy files from vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app (or other theme) to @app/views.
  • Remove the custom view configuration from your application by deleting the path mappings, if you have made them before.
  • Edit your views adhering to html markup vendor/almasaeed2010/adminlte/pages
Skins
By default the extension uses blue skin for AdminLTE. You can change it in config file.
'components' => [
    'assetManager' => [
        'bundles' => [
            'dmstr\web\AdminLteAsset' => [
                'skin' => 'skin-black',
            ],
        ],
    ],
],

And then just replace class of body skin-blue. You can use AdminLteHelper::skinClass() if you don't want to alter every view file when you change skin color.
     <body class="<?= \dmstr\helpers\AdminLteHelper::skinClass() ?>">


自己的总结:
菜单
因为用了admin组件,在AdminLTE中动态获得菜单,可以用如下方法
<?=  dmstr\widgets\Menu:: widget (
    [
        'options'  => [ 'class'  =>  'sidebar-menu' ],
        'items'  => \mdm\admin\components\MenuHelper:: getAssignedMenu (Yii:: $app -> user -> id ),
    ]
?>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值