how to use bootstrap with Yii?

13,735

Found the answer you need to put the following in your main.php file of your protected/views/layouts folder anywhere between <head> and </head> tag.

    <?php Yii::app()->bootstrap->registerAllCss(); ?>
Share:
13,735
Sahil
Author by

Sahil

Please check out my portfolio website at: http://www.sahilsaid.com

Updated on June 04, 2022

Comments

  • Sahil
    Sahil almost 2 years

    I have been trying to implement twitter bootstrap extension in Yii but cannot do it.

    I am following the guide below to install it with Yii.

    http://www.cniska.net/yii-bootstrap/setup.html

    I copied and pasted the following code in my main config file as described in above guide.

    // Define a path alias for the Bootstrap extension as it's used internally.
    // In this example we assume that you unzipped the extension under     protected/extensions.
    Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
    
    return array(
    'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
    'modules'=>array(
        'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),
        ),
    ),
    'components'=>array(
        'bootstrap'=>array(
            'class'=>'bootstrap.components.Bootstrap',
        ),
    ),
    );
    

    Can anyone please help.