Showing 21-40 of 652 items.

Understanding Virtual Attributes and get/set methods

Created 15 years ago by Steve Friedl Steve Friedl, updated 15 years ago by GOsha GOsha. 20 comments

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...

66 0
44
Viewed: 220 485 times
Version: 1.1
Category: Tutorials

How to upload image(photo), and path entry in database with update functionality

Created 14 years ago by kiran sharma kiran sharma, updated 13 years ago by Shahcheraghean Shahcheraghean. 22 comments

I saw many posts that community newbie is confuse in image/photo upload with random name. so I post this topic covering all useful things regarding to image/photo upload(not covering image attribute related functionality)

15 0
39
Viewed: 219 061 times
Version: 1.1
Category: Tips

Relations: BELONGS_TO versus HAS_ONE

Created 15 years ago by Steve Friedl Steve Friedl, updated 13 years ago by Jorgee Jorgee. 9 comments

It's very common to see new Yii users confusing the relations HAS_ONE and BELONGS_TO, and getting it wrong means you won't get proper values back. And though we'll talk about HAS_MANY as well, we're specifically omitting the MANY_MANY relation because it's a whole different animal.

56 0
35
Viewed: 173 970 times
Version: 1.1
Category: FAQs

Behaviors & events

Created 17 years ago by pestaa pestaa, updated 13 years ago by Gismo Gismo. 10 comments

These features provide endless possibilities and unbelievable flexibility, but as current documentation does not give more than a few examples, it might be difficult to fully understand their internals and requirements.

43 0
48
Viewed: 173 101 times
Version: 1.1
Category: Tutorials