cakePHP 3和Bootstrap-ui App of App \ View \ AppView :: initialize()

时间:2015-04-15 14:31:15

标签: cakephp-3.0

我已经使用composer安装了Bootstrap-UI插件,并将该插件加载到bootstrap.php中。

当我向ViewApp.php添加必要的代码时,我收到错误。

Strict (2048): Declaration of App\View\AppView::initialize() should be compatible with Cake\View\View::initialize() [APP/View/AppView.php, line 22]
Code Context
*/
class AppView extends View
{

我添加的代码是:

class AppView extends View
{

    public $layout = 'BootstrapUI.default';

    public function initialize(array $config)
    {
        $this->loadHelper('Html', ['className' => 'BootstrapUI.Html']);
        $this->loadHelper('Form', ['className' => 'BootstrapUI.Form']);
        $this->loadHelper('Flash', ['className' => 'BootstrapUI.Flash']);
        $this->loadHelper('Paginator', ['className' => 'BootstrapUI.Paginator']);
     }

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,我删除了'数组$ config'在初始化函数中。

public function initialize()
{
   // Code from Plugin
}

您还需要在视图中添加<?php $this->extend('../Layout/TwitterBootstrap/dashboard'); ?>以获得引导程序外观。