Bootstrap3 Yii小部件包含错误

时间:2014-08-26 17:43:31

标签: php yii twitter-bootstrap-3

我已经配置了Yii bootstrap3扩展程序BsHtmlbootstrap.widgets.BsPanel工作正常但是当我使用bootstrap.widgets.BsGridViewBsNavbar时出现以下错误:

include(BsWidget.php): failed to open stream: No such file or directory 

on F:\wamp\www\yii\framework\YiiBase.php(427)

3 个答案:

答案 0 :(得分:1)

Yii::import('bootstrap.widgets.BsWidget');

在课程定义之前,在需要时寻找它

答案 1 :(得分:0)

您可以插入

Yii::setPathOfAlias('bootstrap.widgets.BsWidget', dirname(__FILE__).'/../extensions/bootstrap/behaviors/BsWidget');
在返回数组之前,在文件protected/config/main.php

答案 2 :(得分:0)

首先你应该打开protected / config / main.php中的main.php 在main.php找到这个鳕鱼

  'components'=>array(

然后在数组中添加以下代码

  'bootstrap'=>array(
        'class'=>'bootstrap.components.Bootstrap',
    ),

例如

'components'=>array(
       'bootstrap'=>array(
        'class'=>'bootstrap.components.Bootstrap',
    ),

之后你应该去protexted / views / layouts / main.php 并找到这个HTML

      <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
      <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
      <!--[if lt IE 8]>
      <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />

然后用

替换它
    <?php
    echo yii::app()->bootstrap->register();
    ?>