Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add downloaded extension to yii 1.11?

can any one tell me how to add extension to my yii? i googled and downloaded Bootstrap 0.9.8 extension and followed the steps described in it but it not working for me. am using Ubuntu , can you please explain step by step am just beginner.

and i don't know how to add extension to yii

like image 243
raghul Avatar asked Sep 24 '12 11:09

raghul


2 Answers

@raghulrnair, assuming that you have some basic knowledge of yii. If not then read the Yii doc http://www.yiiframework.com/doc/guide/1.1/en/quickstart.what-is-yii

explaining it in conjunction with http://www.cniska.net/yii-bootstrap/setup.html#setup


1) Download the bootstrap extension, and unzip it into "protected/extensions/bootstrap". Once this step is done, then you must see following folders.

protected/extensions/bootstrap/assets
protected/extensions/bootstrap/gii
protected/extensions/bootstrap/components
protected/extensions/bootstrap/lib
protected/extensions/bootstrap/widgets

2) "Application Configuration" plays important role when installing extensions. By default this configuration will be in a php file (i.e protected/config/main.php )


3) Simply edit that file and search for "preload". if found then add "bootstrap" to that array

'preload'=>array( 'log', 'bootstrap'),

if not found,

'preload'=>array('bootstrap'),

4) Now Search for "components", then add bootstrap to that array like below

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

5) If you want to auto generate bootstrap code ( crud, views, models etc.. ) follow this step. ( This is optional if you don't want ) add bootstrap to gii in 'modules' configuration.

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

6) Your configuration is done. SETUP IS DONE.


7) Start coding using bootstrap in your views or use gii to generate code.

Many examples are given at http://www.cniska.net/yii-bootstrap/

one example, If you want to display a menu, then edit the view file and add this code.

<?php $this->widget('bootstrap.widgets.TbMenu', array(
    'type'=>'tabs', // '', 'tabs', 'pills' (or 'list')
    'stacked'=>false, // whether this is a stacked menu
    'items'=>array(
        array('label'=>'Home', 'url'=>'#', 'active'=>true),
        array('label'=>'Profile', 'url'=>'#'),
        array('label'=>'Messages', 'url'=>'#'),
    ),
)); ?>

8) Thats it.

like image 106
SuVeRa Avatar answered Nov 07 '22 18:11

SuVeRa


Link to download bootstrap: http://www.yiiframework.com/extension/bootstrap

Assign permissions to extensions/bootstrap that you uncompressed:

chmod 755 bootstrap
like image 1
Roman Avatar answered Nov 07 '22 18:11

Roman