Showing 101-120 of 120 items.

Customizing Yii's formatting rules (extending CFormatter)

Created 15 years ago by Haensel Haensel, updated 15 years ago by Haensel Haensel. 0 comments

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

12 0
6
Viewed: 25 992 times
Version: 1.1
Category: Tips

1:n relations sometimes require CDbCriteria.together

Created 14 years ago by fsb fsb, updated 12 years ago by fsb fsb. 5 comments

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.

15 0
12
Viewed: 56 326 times
Version: 1.1
Category: Tips

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

Special $variables in CGridView and CListView

Created 15 years ago by Steve Friedl Steve Friedl, updated 15 years ago by Steve Friedl Steve Friedl. 11 comments

The popular [CListView] and [CGridView] widgets each take a data provider and iterate over each data object produced, calling the user's code to render each row one at a time, and most are familiar with the use of the $data variable to represent the current model object or array.

23 1
33
Viewed: 82 581 times
Version: 1.1
Category: Tips

Adding Yii Search to Your Browser Search Box

Created 15 years ago by qiang qiang, updated 8 years ago by CeBe CeBe. 1 comment

The official Yii project site now supports OpenSearch. This means you can customize your browser's search box to enable direct search of the content in yiiframework.com. For example, by entering a Yii class name in the browser's search box, the corresponding class API page will be shown in the browser.

25 0
6
Viewed: 72 772 times
Version: all
Category: Tips

URL component access functions

Created 15 years ago by Steve Friedl Steve Friedl, updated 15 years ago by Steve Friedl Steve Friedl. 1 comment

Many applications wish to obtain parts of the URL for the current page (the hostname, the query string, etc.), and the CHttpRequest class wraps various $_SERVER variables to break down the URL into its constituent parts.

28 0
16
Viewed: 23 797 times
Version: 1.1
Category: Tips

Code style

Created 15 years ago by zaccaria zaccaria, updated 15 years ago by g3ck0 g3ck0. 2 comments

Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.

29 0
7
Viewed: 33 970 times
Version: 1.1
Category: Tips