kadekjayak / semantic-ui
此包的最新版本(0.2)没有提供许可信息。
CakePHP 的 SemanticUI 插件
0.2
2016-08-11 04:55 UTC
Requires
- php: >=5.4.16
- cakephp/cakephp: ~3.0
Requires (Dev)
This package is not auto-updated.
Last update: 2024-09-14 18:53:16 UTC
README
这是 CakePhp 的 Semantic UI 插件,它包含 Bake 主题、修改后的组件和助手。
安装
使用 composer 安装
composer require kadekjayak/semantic-ui
或者下载并提取到 cakephp 的插件目录中。
之后,您需要手动加载插件,将其添加到 Bootstrap.php 中
Plugin::load('SemanticUI', ['bootstrap' => false, 'routes' => true]);
##要求
- CakePHP 3+
示例
使用 Bake 主题
您可以使用 --theme
选项使用 Semantic UI 主题进行 bake,您可以在终端中使用以下命令:
/bin/cake bake template all --theme SemanticUI
并使用插件中包含的布局,例如更改您的 src/Controller/AppController.php
。 (实际上我不知道这是否是正确的方式)
public function beforeRender(Event $event)
{
$this->viewBuilder()->layout('SemanticUI.semantic');
if (!array_key_exists('_serialize', $this->viewVars) &&
in_array($this->response->type(), ['application/json', 'application/xml'])
) {
$this->set('_serialize', true);
}
}
要获取带样式的输入表单,您应该使用此插件的表单助手,您可以通过在 src/View/AppView.php
中加载 FormHelper
时传递 className
选项来使用此插件的表单助手
public function initialize()
{
$this->loadHelper('Form', ['className' => 'SemanticUI.SemanticForm']);
$this->loadHelper('Paginator', ['className' => 'SemanticUI.SemanticPaginator']);
$this->loadHelper('Html', ['className' => 'SemanticUI.SemanticHtml']);
}
##注意事项:有关 Semantic UI 的更多信息,请访问他们的官方网站: https://semantic-ui.com.cn/