arodu/cakelte

CakeLTE: CakePHP 的 AdminLTE 插件

维护者

详细信息

github.com/arodu/cakelte

源代码

问题

资助包维护!
Ko Fi

安装数: 13,689

依赖关系: 1

建议者: 0

安全性: 0

星标: 29

关注者: 4

分支: 6

开放问题: 3

类型:cakephp-plugin

v2.0.1 2024-03-05 11:41 UTC

README

如果它对您有帮助,您可以通过购买我一杯咖啡来支持,谢谢!

ko-fi

入门指南

依赖关系

安装

您可以使用 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.default
  • CakeLte.login
  • CakeLte.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.php
    • templates/layout/login.php
    • templates/layout/top-nav.php
  • 内容
    • templates/element/content/header.php
  • 头部导航栏
    • templates/element/header/main.php
    • templates/element/header/menu.php
    • templates/element/header/messages.php
    • templates/element/header/notifications.php
    • templates/element/header/search-default.php
    • templates/element/header/search-block.php
  • 页脚
    • templates/element/footer/main.php
  • 左侧边栏
    • templates/element/sidebar/main.php
    • templates/element/sidebar/menu.php
    • templates/element/sidebar/search.php
    • templates/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

Page Debug with default layout

Page Debug with top-nav layour

许可证

本项目受 MIT 许可证的许可 - 有关详细信息,请参阅 LICENSE 文件。