Yii2 集成 adminlteasset
https://github.com/dmstr/yii2-adminlte-asset
AdminLTE Asset Bundle Backend UI for Yii2 Framework, based on AdminLTE "Yii2 AdminLTE Presentation" This package contains an Asset Bundle for Yii 2.0 Framework which registers the CSS files for the AdminLTE user-interface. The CSS files are installed via Yii's recommended usage of the fxp/composer-asset-plugin v1.1.1 or later. 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.*"
Quick Start Once the extension is installed, you can have a preview by reconfiguring the path mappings of the view component: For Yii 2 Advanced Application Template or Basic Application Template 'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app'
],
],
],
],
For Phundament 4 'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app'
],
],
],
],
This asset bundle provides sample files for layout and view (see folder examples/), they are not meant to be customized directly in the vendor/ folder. Therefore it is recommended to copy the views into your application and adjust them to your needs. 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
AdminLTE Plugins Assets for AdminLTE plugins are not included in our AdminLteAsset but you can find these files in your vendor directory under vendor/almasaeed2010/adminlte/plugins. So if you want to use any of them we recommend to create a custom bundle where you list the plugin files you need: use yii\web\AssetBundle;
class AdminLtePluginAsset extends AssetBundle
{
public $sourcePath = '@vendor/almasaeed2010/adminlte/plugins';
public $js = [
'datatables/dataTables.bootstrap.min.js',
// more plugin Js here
];
public $css = [
'datatables/dataTables.bootstrap.css',
// more plugin CSS here
];
public $depends = [
'dmstr\web\AdminLteAsset',
];
}
As this asset depends on our AdminLteAsset it's the only asset you have to register, for example in your main.php layout file. 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() ?>">
Note: Use AdminLteHelper::skinClass() only if you override the skin through configuration. Otherwise you will not get the correct css class of body. Here is the list of available skins: "skin-blue",
"skin-black",
"skin-red",
"skin-yellow",
"skin-purple",
"skin-green",
"skin-blue-light",
"skin-black-light",
"skin-red-light",
"skin-yellow-light",
"skin-purple-light",
"skin-green-light"
If you want to use native DOM of headers AdminLTE <h1>
About <small>static page</small>
</h1>
then you can follow the code: /* @var $this yii\web\View */ $this->params['breadcrumbs'][] = 'About'; $this->beginBlock('content-header'); ?>
About <small>static page</small>
<?php $this->endBlock(); ?> <div class="site-about">
<p> This is the About page. You may modify the following file to customize its content: </p>
<code><?= __FILE__ ?></code>
</div>
Left sidebar menu - Widget Menu If you need to separate sections of the menu then just add the li.header item to items 'items' => [
['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']],
['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug']],
['label' => 'MAIN NAVIGATION', 'options' => ['class' => 'header']], // here
// ... a group items
['label' => '', 'options' => ['class' => 'header']],
// ... a group items
['label' => '', 'options' => ['class' => 'header']],
// ... a group items
To add a label for a item: 'items' => [
[
'label' => '<span>Mailbox</span><span class="pull-right-container"><small class="label pull-right bg-yellow">' . $mailCount . '</small></span>',
'icon' => 'fa fa fa-envelope-o',
'url' => ['/mailbox'],
'encode' => false,
],
Further Information For AdminLTE documentation, please read https://almsaeedstudio.com/themes/AdminLTE/documentation/index.html Namespacing rules follow the Yii 2.0 framework structure, eg. dmstr\web for the Asset Bundle.
Yii2 集成 adminlteasset的更多相关文章
- yii2集成富文本编辑器redactor
作者:白狼 出处:http://www.manks.top/article/yii2_redactor本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保 ...
- YII2集成GOAOP,实现面向方面编程!
引言: 软件开发的目标是要对世界的部分元素或者信息流建立模型,实现软件系统的工程需要将系统分解成可以创建和管理的模块.于是出现了以系统模块化特性的面向对象程序设计技术.模块化的面向对象编程极度地提高了 ...
- Yii2的相关学习记录,后台模板和gii(三)
前面已经可以正常登录,但我们需要体验下最常用的增删查改的操作.这里就需要gii,通过gii可以方便的生成表单.表格的框架,不需要我们再写重复的东西. gii访问地址:http://localhost/ ...
- Codeception 实战
Codeception 测试 Php 代码 一.一句话概述 使用 cc 进行单元测试,保证现有代码质量,为以后维护与重构提供支撑. 二.目标 安装配置 cc 编写测试代码,简化开发与最大化稳定性和可维 ...
- Yii2系列教程六:集成编辑器
上一篇文章我们实现了简单的用户权限管理,至于更先进的RBAC,我后面会单独出一篇文章来说说.在这一篇文章当中,我主要想写的是在Yii2中集成一个编辑器,因为在我们的实际开发当中,一个简单的textar ...
- YII2框架集成go!aop
AOP实践:YII2框架本身拥有一个功能,叫做行为.它可以动态的为当前的类附加额外的功能,但这种功能在代码层级结构是静态的,有侵入性的. 下面以YII2框架集成go!aop库为例,介绍在YII2中如何 ...
- yii2.0 app上集成支付宝支付
1.首先从支付宝官网下载支付宝app支付sdk 地址 : https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.hLEa5O&a ...
- yii2.0 集成/引入第三方sdk
首先下载自己要使用的sdk包放到vendor文件夹下面:我以接入ping++为例子如下: 然后在入口文件出引入文件的配置文件: 下面就是在控制器使用了: 下面就可以根据自己要使用的的文件以及方法正常调 ...
- Yii2.0 集成使用富头像上传编辑器
在开发过程中,我们会用到头像上传的功能.这里给大家推荐一款比较流行的头像上传组件,FullAvatarEditor 2.3(富头像上传编辑器). 实际效果如图所示: 1.下载组件,下载地址:http: ...
随机推荐
- 【BZOJ】3670: [Noi2014]动物园(KMP)
题目 传送门:QWQ 分析 像求next一样求num. 第二次求next时加上不超过一半的条件. 时间复杂度: $ \huge O ( n ) $ 代码 // luogu-judger-enable- ...
- JAVA构造函数在超类和子类调用注意事项
1.构造函数: 当子类继承一个父类时,构造子类时需要调用父类的构造函数,存在三种情况 (1),父类无构造函数或者一个无参数构造函数,子类若无构造函数或者有无参数构造函数,子 ...
- python执行报错 configparser.NoSectionError: No section: 'section_1'
场景:请求获取验证码模块regVC.py读取配置文件config.ini时,regVC.py模块单独执行正常,但通过run_all.py模块批量执行时报错,找不到section 解决办法:配置文件路径 ...
- http协议及web框架
http协议简介 HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于万维网(WWW:World Wide Web )服务器与本地浏览器之间传输超文本 ...
- JSP页面中的时间显示问题
在JSP页面中往往要将时间显示为指定格式的,如果传入的是Date类型很好解决 <fmt:formatDate value="${orderTime}" pattern=&qu ...
- Oracle11gr2_ADG管理之在备库上模拟failover的过程实战
技术建议和方案. 要求failover后不重建备库,并能够把failover的数据库重新切换回备库 主库为newtest,备库为snewtest 备库上已经开启了闪回 得到一个参考的SCN SQL&g ...
- properties 中文乱码问题的解决
在用properties处理配置信息时,发现有时出现中文乱码的问题,后经查资料得知是由于编码不一致引起的.于是解决之. [原理解释] 我们用 API操作properties文件,如果获取的属性值是中文 ...
- avalon最佳实践
最近从angular的QQ群与新浪微博拉了许多人来用我的avalon,成为第一批登上方舟,脱离DOM苦海的人.短短三个月内,5群的朋友也搞出几个切实实行的案例了.为应对粉丝们高益高涨的热情,遂放出此文 ...
- java创建TXT文件并进行读、写、修改操作
import java.io.*; /** * * 功能描述:创建TXT文件并进行读.写.修改操作 * * @author <a href="mailto:zha ...
- 读书笔记 Week7 2018-4-19
<构建之法> 第十二章 用户体验 读书笔记 首先不得不说,现如今大部分的电脑使用者,都被微软的图形化界面把口味养刁了.当然,包括我自己.无论是在微机原理上级的时候使用那些带着浓郁的上世纪八 ...