Yii PHP Framework 1.1.x Yii PHP Framework: Best for Web 2.0 Development yii is a high-performance component-based php framework best for web 2.0 development.

Include CSS,javascript file in Yii Framework

How to include a Javascript or CSS file in Yii Framework?

I want to create a page on my site that has a little Javascript application running, so I want to include .js and .css files in a specific view.

Source: (StackOverflow)

Get current URL/URI without some of $_GET variables

How, in Yii, to get the current page's URL. For example:

but excluding the $GET_['lg'] (without parsing the string manually)?

I mean, I'm looking for something similar to the Yii::app()->requestUrl / Chtml::link() methods, for returning URLs minus some of the $_GET variables.

Edit: Current solution:

unset $_GET['lg'];

echo Yii::app()->createUrl(
  Yii::app()->controller->getId().'/'.Yii::app()->controller->getAction()->getId() , 

Source: (StackOverflow)

Quickest ways to speed up your YII application?

I've just started using YII and managed to finish my first app. unfortunately, launch day is close and I want this app to be super fast. So far, the only way of speeding it up I've come across, is standard caching. What other ways are there to speed up my app?

Source: (StackOverflow)

addColumn yii migration position

I want to add a column at the seventh place in the table, I am using


adds the column at the end. Is there any way where I can mention the place to add column? Or any after column keyword to add my new column after, for exapmle, password column. I have learnt aboout migration from Yii Doc

Source: (StackOverflow)

multi model forms in yii

How to create a multi-model form in Yii? I searched the entire documentation of Yii, but got no interesting results. Can some one give me some direction or thoughts about that? Any help will be appreciable.

Source: (StackOverflow)

Yii framework: Controller/Action url & parameters

In my application , I have ApiController with actionUsers, So in YII the path becomes api/users. Now in order to get certain users info , I use the following path api/users/id/10 where 10 is the userID and id part of the path is basically a GET parameter (api/users?id=10).

Is there any way to do the same thing without id part of the path, i.e. I want my path to look like api/users/10?

Thank you!

Source: (StackOverflow)

What is the difference between homeUrl and baseUrl in Yii frame work?

What is the difference between homeUrl and baseUrl in Yii frame work ?

Source: (StackOverflow)

Yii: Render action using different layout than controller's layout

In Yii, is there a way to render a single action using a different layout than that defined for the controller? I have an action that I would like to format differently from the rest, and it's not clear from the documentation if that's possible.

Source: (StackOverflow)

Cakephp and Yii: similarities/differences/speed?

I am a CakePhp programmer. I have decided to try out the Yii framework. I would like to find out in what ways is CakePhp is similar to and different from Yii. Also, is Yii measurably faster than CakePhp as they claim?

Source: (StackOverflow)

yii: how to make a unique rule for two attributes

I have a table like this: (id, name, version, text). (name, version) is unique key, how can i make a rule to validate this.

Source: (StackOverflow)

how to pass parameter on redirect in yii

I am using Yii framework for my project;

I am redirecting page after success of insertion in database to another controller using


During the redirection is it possible to pass any parameters just like in render,

$this->render('selectRefiner', array('param' => $data)

Source: (StackOverflow)

A CMS based on Yii? [closed]

i've been with Yii for a few months and before I use main CodeIgniter, SilverStripe in my projects. Does anyone know a good Yii based CMS such as SilverStripe based on Sapphire or EE based on CodeIgniter ?

My experience is working with Yii is much more easier and straightforward assuming you are good OOP coder but Yii is still young and there are not lot of samples that I can put together quickly for a real prodcution project.

A couple of YII based CMS I spotted at do not look really promising or maybe at a very early stage such as dotPlant, Web3CMS.

Source: (StackOverflow)

Where to learn Yii? [closed]

I have been trying to learn Yii without luck. I find Zend Framework, Kohana, Code Igniter among other frameworks much easier to learn than Yii. The documentation also su**s. Can you post links to easy-to-understand and well written tutorials/articles? The official documentation is filled with grammar errors and seems to be rushed...

Source: (StackOverflow)

How to get response as json format(application/json) in yii?

How to get response as json format(application/json) in yii?

Source: (StackOverflow)

yii2 data provider default sorting

In yii this code works for default sorting:

$dataProvider = new CActiveDataProvider('article',array(
            'defaultOrder'=>'id DESC',

How default sorting can be set in yii2?

tried below code, but no result:

$dataProvider = new ActiveDataProvider([
        'query' => $query,
        'sort' => ['defaultOrder'=>'topic_order asc']

Source: (StackOverflow)