Let's take the example of the above article to display an email button next to a delete button:
Let's take the example of the above article to display an email button next to a delete button:
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 `...
Here is a step by step To-Do list for Yii beginners. The list is an advice of what tutorials and documentation you can walk through to get a full understanding of the Yii Framework. These can be a help to learn Yii.
Here are all wiki articles from "Understanding" series by Yii wiki contributors:
Scenarios are an extremely useful tool for separating validation tasks on any class you use derived from CModel. In this tutorial we will use CActiveRecord.
If we take a look at the blog demo we have 3 major parts of our view rendering. They are:
When you define or extend a class, you can create class variables and methods in Yii just like you can in any other PHP system:
class Comment extends CActiveRecord {
public $helperVariable;
public function rules() { ... }
...
}
and then use them in the obvious way:
$var = $model->helperVariable;
$rules = $model->rules();
This part everybody understa...
Many Yii users ask how to create helper classes and functions, and though there are numerous approaches spread out among the forum and wiki articles, this Tutorial tries to bring it all together in one place.
A common source of confusion among new Yii users is how the 'safe'
validator works, how it works with other validators, and why it's necessary in the first place. This article means to clear up this confusion, as well as explain the notion of Massive Assignment.
Many newcomers to Yii ask about the assets/
directory found under the webroot, and this article means to explain why it's there and how to work with it.
Authentication and Authorization is a good tutorial. Among other topics, it describes basic aspects of Yii's RBAC implementation. But however hard I read the tutorial, I couldn't understand how exactly the hierarchy works. I found how to define authorization hierarchy, how business rules are evaluated, how to configure a...
Set your messages in a controller:
Yii::app()->user->setFlash('success', "Data1 saved!");
Yii::app()->user->setFlash('error', "Data2 failed!");
Yii::app()->user->setFlash('notice', "Data3 ignored.");