Senthilkumar Sp
Senthilkumar Sp

Reputation: 3

Bootstrap3 Yii widget include error

I have configured Yii bootstrap3 extension BsHtml and bootstrap.widgets.BsPanel are working fine but when I use bootstrap.widgets.BsGridView or BsNavbar I am getting following error:

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

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

Upvotes: 0

Views: 449

Answers (3)

moein kh
moein kh

Reputation: 479

first you should open the main.php in protected/config/main.php find this cod in the main.php

  'components'=>array(

and then add the below code in the array

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

for example

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

after that you should go to the protexted/views/layouts/main.php and find this 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" />

and then replac it with

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

Upvotes: 0

Denis
Denis

Reputation: 11

You can insert

Yii::setPathOfAlias('bootstrap.widgets.BsWidget', dirname(__FILE__).'/../extensions/bootstrap/behaviors/BsWidget');

in file protected/config/main.php before returning array.

Upvotes: 0

Developerium
Developerium

Reputation: 7265

put

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

before class definition, to look for it, whenever needed

Upvotes: 1

Related Questions