To use your custom css file globally, set the cssfile property in config file 'components'=>array( 'widgetFactory'=>array( 'widgets' => array ( 'cssFile' => '/css/style-gridview.css', ) ), );
To retrieve a cookie with the specified name: $cookie=Yii::app()->request->cookies[$name]; $value=$cookie->value; To send a cookie: $cookie=new CHttpCookie($name,$value); Yii::app()->request->cookies[$name]=$cookie;
In view file $this->uniqueid (controller name) $this->action->Id (action name) ($this is CController instance) In other files Yii::app()->controller->id Yii::app()->controller->action->id
Source: http://www.yiiframework.com/wiki/25/using-cautocomplete-to-display-one-value-and-submit-another/ Don’t forget to use the attached Javascript and CSS files. This code does not work with jQuery UI auto complete. Javascript File CSS File
You can also configure modules’ components in the main config file 'modules'=>array( 'my'=>array( 'components'=>array( 'foo'=>array( 'class'=>'FooComponent', 'a'=>'hello', ), ), ), ),
The following validation rule uses an error message that is different from the default one class Post extends CActiveRecord { public function rules() { return array( array('title, content', 'required', 'message'=>'Please enter a value for {attribute}.'), // ... other rules ); } } Source: http://www.yiiframework.com/doc/cookbook/1/
A convenient drop down to select page size and save in User state. Step 1: On top of my controller action for the gridview (if you used CRUD, this is actionAdmin() ) i added: // page size drop down changed if (isset($_GET['pageSize'])) { Yii::app()->user->setState('pageSize',(int)$_GET['pageSize']); unset($_GET['pageSize']); // would interfere with pager and […]