YII Framework Archive

Pagination example in Php Yii Framework

Pagination example in Php Yii Framework While working we need to perform pagination.  Whether to show the list of articles, users or products, we need pagination. In Yii it is very easy to implement pagination. [crayon-5bcf250010d0d392850650/]   The above code will get 10 results per page from Database. [crayon-5bcf250010d22135156538/] You can also find more detail on

Include JavaScript and CSS file in Yii Framework

Include JavaScript and CSS file in Yii Framework While working on a project in YII in beginning I came to know a very nice way of including JavaScript and CSS style files in the Layout / View file  in YII Framework. In YII we use [crayon-5bcf250011c1b673789586/] and [crayon-5bcf250011c2c653506813/] functions. Please see the code below. [crayon-5bcf250011c38850851966/]

Yii Framework- Creating hidden field

In Yii framework we can create a hidden field using model and without model as described below 1. Creating hidden field without model. echo CHtml::hiddenField('name' , 'value', array('id' => 'name')); 2. Creating hidden field with model. echo $form->hiddenField($model, 'name');

YII – Get Controller name

In Yii framework if we want to get name of current controller name. It can be done by following command. [crayon-5bcf2500121a7477814925/]  

YII – Get name of current controller’s action

In Yii framework if we want to get name of current controller’s action. It can be done by following command. [crayon-5bcf250013169211725873/]          

YII – Changing Language

If we want to change language of a particular action in YII or for the whole application we need to , set CApplication::language . This can be done at runtime as in [crayon-5bcf25001391e203101343/] [crayon-5bcf250013934774459269/] [crayon-5bcf250013943197162511/] [crayon-5bcf250013952030328148/]