Wiki

Articles in category "tutorials", sorted by viewsX
Displaying 1-10 of 203 result(s).

By Example: CHtml

Created 4 years ago by jonahTutorials13 comments – viewed 432,775 times – ( +98 / -1 ) – version 1.1
"By Example" cookbook pages will provide coding examples for many of the commonly used classes within Yii. We will try to provide as many usage examples as possible for keep these pages as helpful as possible.

How to upload a file using a model

Created 5 years ago by qiangTutorials26 comments – viewed 270,721 times – ( +80 / -6 ) – version 1.1
First declare an attribute to store the file name in the model class (either a form model or an active record model). Also declare a file validation rule for this attribute to ensure a file is uploaded with specific extension name.
tags: File upload

Creating a dependent dropdown

Created 5 years ago by dalipTutorials36 comments – viewed 215,167 times – ( +103 / -3 ) – version 1.1
Often you'll need a form with two dropdowns, and one dropdown's values will be dependent on the value of the other dropdown. Using Yii's built-in AJAX functionality you can create such a dropdown.

Yii for beginners

Created 2 years ago by rackyczTutorials13 comments – viewed 186,618 times – ( +91 ) – version 1.1
Hi. This is first article with my Yii tutorial. I had to split it into more articles as there's limited length of texts on Wiki. So once you understand basics, you can read next article here: Yii for beginners 2.

NetBeans IDE and Yii projects

Created 3 years ago by marcovtwoutTutorials28 comments – viewed 153,752 times – ( +75 ) – version 1.1
This page is created to supply short directions and general tips for managing a Yii application in NetBeans IDE.

Update content in AJAX with renderPartial

Created 4 years ago by BurzumTutorials15 comments – viewed 150,396 times – ( +56 ) – version 1.1
The easiest way to update content in AJAX is to use the renderPartial method.
tags: AJAX

How to work with flash messages

Created 5 years ago by pfthTutorials9 comments – viewed 139,152 times – ( +57 ) – version 1.1
Set your messages in a controller:

How to use a single form to collect data for two or more models?

Created 5 years ago by qiangTutorials15 comments – viewed 124,822 times – ( +107 / -1 ) – version 1.1
Assume we want to use a single HTML form to collect input for both model A and model B, and we want to display input errors (if any) in the same error summary box. We can define the following action code:

Searching and sorting by related model in CGridView

Created 2 years ago by redguyTutorials72 comments – viewed 106,901 times – ( +102 ) – version 1.1
Lets say we have two models and relation between them:

How to add more information to Yii::app()->user

Created 5 years ago by qiangTutorials1 comment – viewed 103,618 times – ( +23 ) – version 1.1
By default, the expression Yii::app()->user returns a CWebUser application component which represents the information that are closely related with the current user. Some information can be persistent throughout the current user session. For example, CWebUser already comes with a name property that stores the username of the current user.