Wiki

Sorted by ratingX
Displaying 131-140 of 483 result(s).

CGridView: Use special variable $data in the htmlOptions of a column (i.e. evaluate htmlOptions attribute)

Created about a year ago by c@cbaTutorials0 comments – viewed 17,298 times – ( +20 / -1 )
    For each column of the CGridView, we can specify name, value, htmlOptions, cssClassExpression etc. In the declarations of the attributes value and cssClassExpression we can use the "special" variable $data, for example like this: 'value'=>'$data->author->username',.     Now we might want to use $data in the declaration of the htmlOptions attribute, which is normally not possible, to generate for example the tag <td id="3" class="name_3">, where 3 is the id of the data model for the current row, i.e. $data->id. That is, we want to be able to use: 'htmlOptions'=>array('id'=>'$data->id', 'class'=>'"name_{$data->id}"')     Here's a way to accomplish this...

Serve jQuery and jQuery-UI from Google's CDN

Created about a year ago by YetiTutorials14 comments – viewed 13,027 times – ( +13 )
There are good reasons to use Google's Content Delivery Network (CDN) to serve jQuery and jQuery UI on your site:

CGridView: Display the full record (actionView) in a CJuiDialog

Created about a year ago by JobloTips7 comments – viewed 22,700 times – ( +13 )
If you show a model (with a lot of attributes) partially in a CGridView, it can be helpful when the user can take a quick look at the full record with all attributes without displaying the view as a page and afterwards returning back to the gridview.

Eclipse PDT - code-hints, references and other goodies

Created 4 years ago by mindehTutorials3 comments – viewed 21,230 times – ( +13 )
Since PHP is dynamically typed language, the way IDE may help you is limited.
tags: IDE

1:n relations sometimes require CDbCriteria.together

Created about a year ago by fsbTips4 comments – viewed 14,540 times – ( +13 )
There are situations in which Active Record will generate nonsense queries from what a nieve Yii user might think is reasonable code. One such situation is a CActiveDataProvider using CDbCriteria to get data from parent and 1:n child table with a condition on the child table.

Simplified meta tags

Created 3 years ago by Y!!Tutorials1 comment – viewed 19,494 times – ( +13 )
If we want to set meta tags on a per page (controller-action) basis, we may use the clientScript application component.

How to log and debug variables using CWebLogRoute

Created 2 years ago by Antonio RamirezHow-tos4 comments – viewed 30,127 times – ( +13 )
I have seen a couple of articles about how to integrate external libraries to debug our PHP code (i.e. firePHP) but after you read this article you will realize that there is no need for such libraries when using Yii.
tags: Logging

Creating a CSS Driven Drop Down Menu using CMenu

Created about a year ago by blindMoeHow-tos7 comments – viewed 38,115 times – ( +19 / -1 )
CMenu offers great functionality and the ability to customize just about every aspect of the output. There are many times when I need to create a drop down menu or simply modify the look to make the designers happy. Because this seems to be a common task for me, I figured I would share my code to create a very simple drop down menu that other people could use.

How to customize the error message of a validation rule

Created 4 years ago by qiangTutorials3 comments – viewed 31,530 times – ( +12 )
Validators extending from CValidator all have a property named message. You can set this property in the corresponding validation rule to customize the error message. For example, the following validation rule uses an error message that is different from the default one:

Database driven Cmenu

Created about a year ago by twisted1919How-tos1 comment – viewed 11,076 times – ( +12 )
This is a simple example that will give you a base for designing a database driven menu system that will use CMenu to be rendered.