Category Archives: Yii Framework

Yii Hint For Form Radio Button

This tutorial will help you to style the radio button list on form. Using template, separator, style and label options, We can give proper style to radio button. <div class=”row”> <?php echo $form->labelEx($model,’isactive’); ?> <?php echo $form->radioButtonList($model,’isactive’, array(‘1’=>’Active’,’0’=>’Inactive’), array( ‘template’=>'{input}{label}’, ‘separator’=>”, ‘labelOptions’=>array( ‘style’=> ‘ padding-left:13px; width: 60px; float: left; ‘), ‘style’=>’float:left;’, ) ); ?> <div […]

Yii Maintenance Mode

This tutorial will useful to change your yiiframework website to maintenance mode. User can access maintenance file only. Maintenance Controller Maintence File Maintenance Controller Make or Point the controller action to maintenance mode. 1 return array( 2 ‘catchAllRequest’=> array(‘site/maintenance’), 3 ………… 4 ………… Maintence File Make or Point the file to maintenance mode. If the condition file_exists() […]

Yii SQL Query To CGridview

CSqlDataProvider implements a data provider based on a plain SQL statement. This tutorial will help you to display the custom sql query result into cgridview as normal crud view. But dont forget to remove the semicolon in custom sql statement Because it will create error on count query. Controller.php <?php ……….. public function actionPending(){ $sql=”SELECT […]

Yii1.0 Custom Access Control With Dynamic Validation

This tutorial will help you to create a custom access method. I have done this method using “module-controller-action” method like “employee_employee_admin”. Here i used the getState and setState method to show the dynamic error file with message(You can try better than this method). Before access the page we can validate the data using this method. […]

Assign Tag And Class To CListview In Yii

Here i added the code for CListview of yii. Using this we can assign the parent tag name and class of parent tag to CListview. <?php $this->widget(‘zii.widgets.CListView’, array( ‘id’=>’commentslistview’, /** tag name **/ ‘itemsTagName’=>’ul’, /** calss name **/ ‘itemsCssClass’=>’commentslist’, ‘dataProvider’=>$commentsProvider, ‘itemView’=>’_comments’, )); ?>