How to install bootstrap extension in yii

yii
17,194

Download extension from here.

Paste all bootstrap extensions folders what you have download under extensions/bootstrap

config/main.php

Add before starting of array Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

Add under return array

'theme'=>'bootstrap',
    'modules'=>array(
        'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),                      
        ),
    ),

Add in under components

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

extensions/boostrap/components/Bootstrap.php

Paste code in class

public function init() {
    $this->registerAllCss();
    $this->registerJs();
    parent::init();
}

protected/views/layout/main.php

Paste the line under head tag

<?php echo Yii::app()->bootstrap->init();?>

Follow this link for documentation

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

Share:
17,194
Ashish
Author by

Ashish

Updated on June 04, 2022

Comments

  • Ashish
    Ashish almost 2 years

    Im a newbie to yii and have been trying to add bootstrap and giiplus extension to yii.However after adding the extracted file to extensions folder and making changes in main.php I cant seem to get error in displaying even the main page.I followed this tutorial..

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

  • Dheeraj singh
    Dheeraj singh almost 11 years
    <pre>'theme'=>'bootstrap', 'modules'=>array( 'gii'=>array( 'generatorPaths'=>array( 'bootstrap.gii', ), ), ), </pre>
  • Dheeraj singh
    Dheeraj singh about 10 years
    'theme' => 'bootstrap', 'modules' => array( 'gii' => array( 'class' => 'system.gii.GiiModule', 'password' => 'admin', 'generatorPaths' => array( 'bootstrap.gii', ), ), ),
  • Dheeraj singh
    Dheeraj singh about 9 years