Wiki

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

By Example: CHtml

Created 5 years ago by jonahTutorials15 comments – viewed 573,963 times – ( +107 / -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 qiangTutorials27 comments – viewed 333,055 times – ( +84 / -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 dalipTutorials51 comments – viewed 258,290 times – ( +108 / -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 3 years ago by rackyczTutorials13 comments – viewed 223,909 times – ( +95 ) – 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.

Update content in AJAX with renderPartial

Created 5 years ago by BurzumTutorials15 comments – viewed 191,257 times – ( +58 ) – 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 pfthTutorials11 comments – viewed 172,102 times – ( +57 ) – version 1.1
Set your messages in a controller:

NetBeans IDE and Yii projects

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

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

Created 5 years ago by qiangTutorials30 comments – viewed 156,353 times – ( +114 / -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 3 years ago by redguyTutorials75 comments – viewed 132,444 times – ( +116 ) – 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 qiangTutorials2 comments – viewed 124,396 times – ( +28 ) – 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.