PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 8, 2022

[FIXED] how to add downloaded extension to yii 1.11?

 March 08, 2022     yii, yii-extensions     No comments   

Issue

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


Solution

@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.



Answered By - SuVeRa
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing