simtecsystem / cakephp-adminlte-theme
CakePHP 3.x AdminLTE 主题 3。
1.1.1
2020-02-17 11:40 UTC
Requires
- php: >=5.6
- cakephp/cakephp: ~3.0
Requires (Dev)
- phpunit/phpunit: ~4.1
README
最新动态
AdminLTE 已更新到 3.0.0 版本。
CakePHP 已更新到与 3.7.0 兼容的版本。
根据 SemVer.org 的建议,这个版本可以被认为是稳定版本。
安装
您可以使用 composer 进行安装。
composer require simtecsystem/cakephp-adminlte-theme
启用插件
// src/Application.php public function bootstrap() { $this->addPlugin('AdminLTE'); }
CakePHP 3.7 之前
// config/bootstrap.php Plugin::load('AdminLTE', ['bootstrap' => true, 'routes' => true]);
启用主题
// src/Controller/AppController.php public function beforeRender(Event $event) { $this->viewBuilder()->setTheme('AdminLTE'); // Before of CakePHP 3.5 $this->viewBuilder()->theme('AdminLTE'); }
启用表单
// src/View/AppView.php public function initialize() { $this->loadHelper('Form', ['className' => 'AdminLTE.Form']); }
配置
// new config/adminlte.php file return [ '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' ] ]; // config/bootstrap.php Configure::load('adminlte', 'default');
CakePHP 3.7 之前
// 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' ]);
自定义布局
如果您想 自定义布局
功能特性
布局
有 10 个布局文件。
- boxed
- collapsed
- default 这是主布局
- 文档
- fixed
- lockscreen
- login
- register
- top
视图块
有 3 个块,您可以扩展您的主题。
- css
<?php echo $this->fetch('css'); ?>
一个例子是 src/Template/Pages/home.ctp
<?php echo $this->Html->css('AdminLTE./bower_components/morris.js/morris', ['block' => 'css']); ?>
- script
<?php echo $this->fetch('script'); ?>
一个例子是 src/Template/Pages/home.ctp
<?php echo $this->Html->script('AdminLTE./bower_components/morris.js/morris.min', ['block' => 'script']); ?>
- scriptBottom
<?php echo $this->fetch('scriptBottom'); ?>
一个例子是 src/Template/Pages/home.ctp
<?php $this->start('scriptBottom'); ?> <script> $.widget.bridge('uibutton', $.ui.button); </script> <?php $this->end(); ?>
元素
有 7 个元素文件。
- Element/
- aside/
- form
- sidebar-menu
- user-panel
- aside-control-sidebar
- aside-main-sidebar
- footer
- nav-top
- aside/
闪存消息
该主题已准备好显示闪存消息。
<?php echo $this->Flash->render(); ?> <?php echo $this->Flash->render('auth'); ?>
Bake
Bake 是 Cake 最好的特性之一。该主题已准备好使用 Bake。
bin/cake bake all user --theme AdminLTE
视图
- AdminLTEView
这是该主题最好的特性之一。它改变了 Cake 显示视图文件的模式。
基本上,您可以覆盖任何主题、插件和前缀文件。
- src/Template/Plugin/$theme/Plugin/$plugin/$prefix/
- src/Template/Plugin/$theme/Plugin/$plugin/
- src/Template/Plugin/$theme/$prefix/
- src/Template/Plugin/$theme/
表单助手
默认情况下,表单助手基于 Foundation 模板格式化模板。这个助手会覆盖这些模板。
行为
- DatepickerBehavior
当您将 App.defaultLocale
配置为 pt_BR
时,此行为很有用。
区域设置
当您将 App.defaultLocale
配置为 pt_BR
时,此区域设置很有用。
页面调试
添加了指向 CakePHP 默认页面的链接。
贡献
- 分支
- 创建您的功能分支(
git checkout -b my-new-feature
) - 提交您的更改(
git commit -am 'Add some feature'
) - 推送到分支(
git push origin my-new-feature
) - 创建新的拉取请求