Wiki

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

By Example: CHtml

Created 3 years ago by jonahTutorials7 comments – viewed 243,322 times – ( +80 )
"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 4 years ago by qiangTutorials21 comments – viewed 173,365 times – ( +68 / -6 )
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 4 years ago by dalipTutorials20 comments – viewed 139,082 times – ( +84 / -2 )
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.
tags: AJAX

NetBeans IDE and Yii projects

Created 2 years ago by marcovtwoutTutorials28 comments – viewed 121,701 times – ( +69 )
This page is created to supply short directions and general tips for managing a Yii application in NetBeans IDE.

Yii for beginners

Created about a year ago by rackyczTutorials11 comments – viewed 106,815 times – ( +74 )
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 3 years ago by BurzumTutorials8 comments – viewed 87,010 times – ( +49 )
The easiest way to update content in AJAX is to use the renderPartial method.
tags: AJAX

How to work with flash messages

Created 4 years ago by pfthTutorials9 comments – viewed 84,240 times – ( +48 )
Set your messages in a controller:

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

Created 4 years ago by qiangTutorials10 comments – viewed 78,284 times – ( +87 )
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:

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

Created 4 years ago by qiangTutorials1 comment – viewed 67,440 times – ( +18 )
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.

Understanding "Assets"

Created 2 years ago by Steve FriedlTutorials11 comments – viewed 64,075 times – ( +52 )
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.