ahmedebead / cakelte
3.3
2021-08-12 04:17 UTC
Requires
- php: >=7.2.0
- cakephp/cakephp: ^4.0
Requires (Dev)
- phpunit/phpunit: ^8.5 || ^9.3
README
新闻动态
CakephpLte已更新到版本3.1.0。
CakePHP已更新到与4.2.0兼容的版本。
安装
您可以使用composer进行安装。
composer require ahmedebead/cakephp-4-lte
复制资源
执行以上命令后,运行此命令
bin/cake plugin assets symlink
启用插件
// src/Application.php public function bootstrap() { $this->addPlugin('CakephpLte', ['autoload' => true, 'bootstrap' => true, 'routes' => true]); }
启用主题
// src/Controller/AppController.php use Cake\Event\EventInterface; public function beforeRender(EventInterface $event) { $this->viewBuilder()->setTheme('CakephpLte'); $this->viewBuilder()->setClassName('CakephpLte.CakephpLte'); }
启用表单
// src/View/AppView.php public function initialize() { $this->loadHelper('Form', ['className' => 'CakephpLte.Form']); $this->loadHelper('Paginator', ['templates' => 'CakephpLte.paginator-templates']); }
配置
// new config/cakephplte.php file return [ 'CakephpLteTheme' => [ 'title' => 'CakephpLte', 'logo' => [ 'mini' => '<b>AE</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('cakelte', 'default');
RTL 支持
只需将 rtl css 和 js 添加到您的布局中(如果您已覆盖它)
// Css <!-- Bootstrap 4 rtl --> echo $this->Html->css('CakephpLte./css/bootstrap.rtl.min.css'); <!-- Custom CSS rtl --> echo $this->Html->css('CakephpLte./css/rtl.css'); // JS <!-- Bootstrap 4 rtl --> echo $this->Html->script('CakephpLte./js/bootstrap.rtl.min.js');
或使用 rtl 布局
$this->layout = 'CakephpLte.rtl';
功能
布局
有2个布局文件。
- default 它是主布局
- rtl
RTL 支持
视图块
有3个块,您可以在其中扩展您的 CakephpLteTheme。
- css
<?php echo $this->fetch('css'); ?>
一个例子是 src/Template/Pages/home.ctp
<?php echo $this->Html->css('CakephpLte./bower_components/morris.js/morris', ['block' => 'css']); ?>
- script
<?php echo $this->fetch('script'); ?>
一个例子是 src/Template/Pages/home.ctp
<?php echo $this->Html->script('CakephpLte./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
- breadcrumb
- footer
- nav-top
- aside/
Flash 消息
主题已准备好显示 Flash 消息。
<?php echo $this->Flash->render(); ?> <?php echo $this->Flash->render('auth'); ?>
Bake
这是 Cake 最好的功能之一。主题已准备好使用 Bake。
bin/cake bake all user --theme CakephpLte
视图
- CakephpLteView
这是主题最好的功能之一。它改变了 Cake 显示视图文件的模式。
基本上,您可以覆盖任何主题、插件和前缀文件。
- src/Template/Plugin/$theme/Plugin/$plugin/$prefix/
- src/Template/Plugin/$theme/Plugin/$plugin/
- src/Template/Plugin/$theme/$prefix/
- src/Template/Plugin/$theme/
FormHelper
FormHelper 默认基于 Foundation 模板格式化模板。此助手会覆盖这些模板。
行为
- DatepickerBehavior
当您将App.defaultLocale
配置为pt_BR
时,此行为会被使用。
区域设置
当您将App.defaultLocale
配置为pt_BR
时,此区域设置会被使用。
页面调试
添加了对 CakePHP 默认页面的链接。
贡献
- 进行分支复制
- 创建您的功能分支(
git checkout -b my-new-feature
) - 提交您的更改(
git commit -am '添加某些功能'
) - 推送到分支(
git push origin my-new-feature
) - 创建新的 Pull Request