jorisvaesen / bootstrap-3-ui
支持 CakePHP 的 Bootstrap 前端框架
1.4.1
2019-02-18 15:33 UTC
Requires
- cakephp/cakephp: ^3.5
Requires (Dev)
- cakephp/chronos: ^1.1
- phpunit/phpunit: ^5.7.14|^6.0
README
在 CakePHP 3 中透明地使用 Bootstrap 3。
允许在同一项目中使用 bootstrap 3 和 4
此存储库与 FriendsOfCake/bootstrap-ui 1.x 版本同步,并使用另一个命名空间,以便在同一项目中安装此软件包用于 bootstrap 3,以及为 bootstrap 4 安装 FriendsOfCake/bootstrap-ui 2.x。
composer require jorisvaesen/bootstrap-3-ui
composer require friendsofcake/bootstrap-ui:2.0.0-beta4
使用方法
在 CakePHP 项目中使用 bootstrap 3 和 4 的最简单方法是为 bootstrap 4 创建额外的 AppView。
编辑当前的 AppView.php 以使用此软件包
// AppView.php use Bootstrap3UI\View\UIViewTrait; class AppView extends View { use UIViewTrait; public function initialize() { parent::initialize(); $this->initializeUI(); }
为使用 bootstrap 4 的页面创建 AppView
// AppView4.php use BootstrapUI\View\UIViewTrait; class AppView4 extends View { use UIViewTrait; public function initialize() { parent::initialize(); $this->initializeUI(); }
通过 AppView 加载 bootstrap 3 或 bootstrap 4 辅助函数
// In any controller initialize() or any action $this->viewBuilder() ->setClassName('App\View\AppView') // Bootstrap 3 ->setClassName('App\View\AppView4') // Bootstrap 4