Showing 1-20 of 652 items.

Reference: Model rules validation

Created 16 years ago by krillzip krillzip, updated 12 years ago by Rodrigo Rodrigo. 7 comments

This is a reference to be used for Model rule validation and is compiled from the Yii documentation and code. The purpose is to have all the information gathered in one place instead of scattered. This reference is not an intro. See The Definitive Guide to Yii, Declaring Validation Rules for a tutorial.

99 0
114
Viewed: 923 508 times
Version: 1.1
Category: How-tos

How to upload a file using a model

Created 17 years ago by qiang qiang, updated 11 years ago by samdark samdark. 8 comments

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.

66 4
64
Viewed: 535 986 times
Version: 1.1
Category: Tutorials

Using CButtonColumn to customize buttons in CGridView

Created 15 years ago by Trejder Trejder, updated 13 years ago by Gismo Gismo. 20 comments

The easiest way to customize look and behaviour of them is to use series of CButtonColumn properties, like: updateButtonImageUrl (path to image for update button), updateButtonLabel (label for the update button; not HTML-encoded), updateButtonOptions (HTML options for this button, used in the way as many htmlOptions property for many widgets) and updateButtonUrl (a PHP expresion th...

75 0
59
Viewed: 359 908 times
Version: 1.1
Category: How-tos

How to write secure Yii1 applications

Created 14 years ago by François Gannaz François Gannaz, updated 5 years ago by François Gannaz François Gannaz. 22 comments
  • Validate the user input (see below for details).
  • Protect (escape) your application output according to context (see below for a few output types, mostly HTML and SQL).
  • Test your application in debug mode.
    Set the constant YII_DEBUG to true (by default, it is defined in index.php) and put alongside error_reporting(E_ALL);. Then errors and warnings will stop the execution an...
80 0
114
Viewed: 340 852 times
Version: 1.1
Category: How-tos

The directory structure of the Yii project site

Created 15 years ago by qiang qiang, updated 13 years ago by Yang He Yang He. 42 comments

In this article, we describe the directory structure used by yiiframework.com - the official Yii framework website. While this structure may look overly complicated for small projects or may not be optimal in some sense, we believe it is appropriate for medium or large projects in a team development environment. In fact, we have successfully used the similar structure in some other big projects.

77 0
95
Viewed: 265 370 times
Version: 1.1
Category: Others

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

Created 17 years ago by qiang qiang, updated 14 years ago by Yang He Yang He. 2 comments

By default, the expression Yii::app()->user returns a [CWebUser] [application component](http://www.yiiframework.com/doc/guide/basics.application#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|CWebUser::name] property th...

21 0
28
Viewed: 241 213 times
Version: 1.1
Category: Tutorials