flickerleap / cakephp-adminlte-theme
CakePHP 3.x AdminLTE 主题。
1.0.6
2017-08-08 07:25 UTC
Requires
- php: >=5.4.16
- cakephp/cakephp: ~3.0
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is not auto-updated.
Last update: 2024-09-24 18:03:20 UTC
README
CakePHP AdminLTE 主题
安装
可以使用 composer 进行安装。
composer require flickerleap/cakephp-adminlte-theme
启用插件
// config/bootstrap.php Plugin::load('AdminLTE', ['bootstrap' => true, 'routes' => true]);
启用主题
// src/Controller/AppController.php public function beforeRender(Event $event) { $this->viewBuilder()->theme('AdminLTE'); }
启用表单
// src/View/AppView.php public function initialize() { $this->loadHelper('Form', ['className' => 'AdminLTE.Form']); }
配置 (自 1.0.6 版本已弃用)
// src/Controller/AppController.php use Cake\Core\Configure; public function beforeRender(Event $event) { // ... $this->set('theme', Configure::read('Theme')); }
// To customize configuration paste it at end of file config/bootstrap.php Configure::write('Theme', [ 'title' => 'AdminLTE', 'logo' => [ 'mini' => '<b>A</b>LT', 'large' => '<b>Admin</b>LTE' ], 'login' => [ 'show_remember' => true, 'show_register' => true, 'show_social' => true ], 'folder' => ROOT, 'skin' => 'blue' // default is 'blue' ]);
自定义布局 (自 1.0.6 版本已弃用)
根据图片替换文件。
src/Template/Element/nav-top.ctp
src/Template/Element/aside-main-sidebar.ctp
src/Template/Element/aside/user-panel.ctp
src/Template/Element/aside/form.ctp
src/Template/Element/aside/sidebar-menu.ctp
src/Template/Element/aside-control-sidebar.ctp
src/Template/Element/footer.ctp
记得在复制要自定义的模板元素时,删除初始的 PHP 块和最后的闭合括号。
自定义布局(自 1.0.6 版本)
// src/Controller/AppController.php use Cake\Core\Configure; public function beforeRender(Event $event) { // ... $this->viewBuilder()->className('AdminLTE.AdminLTE'); }
在 AppController.php 文件中启用 AdminLTEView 类后,您可以通过在模板文件夹内创建 Plugin / AdminLTE / 文件夹来覆盖任何视图文件。
例如,要覆盖元素文件,必须按以下方式创建它们
src/Template/Plugin/AdminLTE/Element/nav-top.ctp
src/Template/Plugin/AdminLTE/Element/aside-main-sidebar.ctp
src/Template/Plugin/AdminLTE/Element/aside/user-panel.ctp
src/Template/Plugin/AdminLTE/Element/aside/form.ctp
src/Template/Plugin/AdminLTE/Element/aside/sidebar-menu.ctp
src/Template/Plugin/AdminLTE/Element/aside-control-sidebar.ctp
src/Template/Plugin/AdminLTE/Element/footer.ctp
最大的新闻是您还可以覆盖前缀的元素。这意味着您可以为具有 Admin 前缀的环境拥有一个页脚元素,并为没有前缀的环境拥有不同的页脚元素。
例如
src/Template/Plugin/AdminLTE/Element/footer.ctp
src/Template/Plugin/AdminLTE/Admin/Element/footer.ctp
页面调试
添加了指向 CakePHP 默认页面的链接。
贡献
- 分叉它
- 创建您的功能分支(
git checkout -b my-new-feature
) - 提交您的更改(
git commit -am 'Add some feature'
) - 推送到分支(
git push origin my-new-feature
) - 创建新的拉取请求