Wiki

Articles in category "tips", sorted by ratingX
Displaying 11-20 of 97 result(s).

The complete beginner's study guide for the Yii Framework

Created 7 months ago by Rodrigo CoelhoTips2 comments – viewed 16,745 times – ( +18 )
Start studying the MVC pattern. You will understand the roles of the model, the view and the controller and know where goes each part of the code.

Using cache in CActiveDataProvider

Created about a year ago by StammTips7 comments – viewed 9,105 times – ( +17 )
First param in CActiveDataProvider could be a string with model name or instance of class. So, you may use CActiveRecord::cache() for cache, but you need set third param to 2, because you should cache 2 queries: counting and get data.

Understanding series articles

Created about a year ago by GOshaTips0 comments – viewed 6,207 times – ( +16 )
Here are all wiki articles from "Understanding" series by Yii wiki contributors:

htmlOptions explained for various controls.

Created 2 years ago by WoilTips1 comment – viewed 24,368 times – ( +16 )
Most controls that are rendered by CHtml have an argument called $htmlOptions. This argument is an array that holds the attributes of the HTML element. For example the following code:

PHPStorm & NetBeans autocomplete problem

Created 2 months ago by StagelineTips0 comments – viewed 2,916 times – ( +16 )
The problem: If you type Yii::app()->user<ctrl+space> code completion didn't work. This solve it.

How to ensure unicity to url

Created about a year ago by zaccariaTips3 comments – viewed 8,174 times – ( +14 )
Many time for SEO porpouses is important that each page will have a unique address.
tags: SEO, unique, URL

Customizing Yii's formatting rules (extending CFormatter)

Created about a year ago by HaenselTips0 comments – viewed 8,343 times – ( +14 )
CFormatter is one of Yii's core components and used to format values displayed in widgets like CGridView or CDetailView. All classic formats like numbers, text, urls or datetime are supported but you may have to use a formatting rule that isn't built in. Let's say we want to display arrays of strings (like tags associated with a product model). When using CDetailView we would usually make use of PHPs implode function to create a simple string value of all values in the $product->tags array.

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

Created about a year ago by JobloTips7 comments – viewed 21,520 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.

1:n relations sometimes require CDbCriteria.together

Created about a year ago by fsbTips4 comments – viewed 13,714 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.

Real Time Logging

Created 2 years ago by lucifuriousTips1 comment – viewed 12,291 times – ( +12 )
I've seen a lot of people asking about the logging facilities in Yii and thought I'd share a nice little class I wrote that provides near real-time logging.