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
@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.
Link to download bootstrap: http://www.yiiframework.com/extension/bootstrap
Assign permissions to extensions/bootstrap that you uncompressed:
chmod 755 bootstrap
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With