arodu / cakelte
CakeLTE: CakePHP 的 AdminLTE 插件
v2.0.1
2024-03-05 11:41 UTC
Requires
- almasaeed2010/adminlte: ^3.2
- cakephp/cakephp: ^5.0
- friendsofcake/bootstrap-ui: ^5.0
Requires (Dev)
- cakedc/cakephp-phpstan: ^3.1
- cakephp/cakephp-codesniffer: ^5.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.1.0
README
如果它对您有帮助,您可以通过购买我一杯咖啡来支持,谢谢!
入门指南
依赖关系
- FriendsOfCake/bootstrap-ui,透明地使用 Bootstrap 4 与 CakePHP 4。
- AdminLTE 3.2,bootstrap 4 管理主题。
安装
您可以使用 composer 将此插件安装到您的 CakePHP 应用程序中。
安装 composer 包的推荐方法是
composer require arodu/cakelte
配置
您可以使用 shell 命令来加载插件
bin/cake plugin load CakeLte
将 AdminLTE 符号链接添加到 webroot
bin/cake cakelte install
如何使用
将文件 vendor/arodu/cakelte/config/cakelte.php 复制到 config/cakelte.php
cp vendor/arodu/cakelte/config/cakelte.php config/cakelte.php
在此文件中,您可以更改 cakelte 配置选项
在 src/View/AppView.php 中使用 trait(推荐)
namespace App\View; use Cake\View\View; use CakeLte\View\CakeLteTrait; class AppView extends View{ use CakeLteTrait; public string $layout = 'CakeLte.default'; public function initialize(): void{ parent::initialize(); $this->initializeCakeLte(); //... } }
或者您可以从 CakeLteView 继承
namespace App\View; use Cake\View\View; use CakeLte\View\CakeLteView; class AppView extends CakeLteView{ public function initialize(): void{ parent::initialize(); //... } }
布局选项
CakeLte.defaultCakeLte.loginCakeLte.top-nav
从 bake 生成代码
bin/cake bake all [command] -t CakeLte bin/cake bake template [command] -t CakeLte login bin/cake bake template [command] -t CakeLte register bin/cake bake template [command] -t CakeLte recovery
要修改模板,您可以复制项目中的一个或所有文件,在 templates/plugin/CakeLte/ 文件夹中复制以下文件,并保持与 templates/ 相同的结构
替换文件元素
- 布局
templates/layout/default.phptemplates/layout/login.phptemplates/layout/top-nav.php
- 内容
templates/element/content/header.php
- 头部导航栏
templates/element/header/main.phptemplates/element/header/menu.phptemplates/element/header/messages.phptemplates/element/header/notifications.phptemplates/element/header/search-default.phptemplates/element/header/search-block.php
- 页脚
templates/element/footer/main.php
- 左侧边栏
templates/element/sidebar/main.phptemplates/element/sidebar/menu.phptemplates/element/sidebar/search.phptemplates/element/sidebar/user.php
- 右侧边栏
templates/element/aside/main.php
或者您可以使用以下命令来复制所有文件
bin/cake cakelte copy_files --all
页面调试
调试链接
echo $this->Html->link(__('CakeLTE debug page'), '/cake_lte/debug' ); // {your-url}/cake_lte/debug
许可证
本项目受 MIT 许可证的许可 - 有关详细信息,请参阅 LICENSE 文件。

