Wiki articles

Showing 1-20 of 650 items.

How to customize the error message of a validation rule

Created 10 years ago by qiang, updated 7 years ago by Yang He.

Validators extending from [CValidator] all have a property named [message|CValidator::message]. You can set this property in the corresponding validation rule to customize the error message. For example, the following validation rule uses an error message that is different from the default one:

12 0
14 followers
Viewed: 119 470 times
Version: 1.1
Category: Tutorials
Tags:

How to upload a file using a model

Created 10 years ago by qiang, updated 4 years ago by samdark.

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.

65 4
64 followers
Viewed: 482 256 times
Version: 1.1
Category: Tutorials

How to setup yiic on WAMP (XP/Vista)

Created 10 years ago by krillzip, updated 7 years ago by Yang He.

This page assumes that you have installed Wampserver on your MS Windows computer.

2 0
5 followers
Viewed: 84 526 times
Version: 1.1
Category: Tutorials
Tags:

How to setup FCKeditor

Created 10 years ago by krillzip, updated 7 years ago by Dark-Sun.

Next to do is to download the Yii FCKeditor extension, created by Ascomae. Extract the downloaded file, and place the fckeditor/ widget folder in your web applications protected/extensions/ directory.

3 1
5 followers
Viewed: 23 242 times
Version: 1.1
Category: Tutorials
Tags:

First Yii App: CTabView

Created 10 years ago by meanpenguin, updated 7 years ago by Yang He.

Once you are completed with the "Creating First Yii Application", the following can be done.

0 2
1 follower
Viewed: 23 215 times
Version: 1.1
Category: Tutorials
Tags:

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

Created 10 years ago by qiang, updated 7 years ago by Yang He.

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 followers
Viewed: 198 138 times
Version: 1.1
Category: Tutorials

Q: My yiic tool cannot run model and crud commands. Why?

Created 10 years ago by qiang, updated 10 years ago by mishhh.

Some PHP installations may use a different php.ini file for CLI PHP (command line PHP parser). As a result, when running the model or crud command in yiic shell, you may encounter errors like "YiiBase::include(PDO.php): failed to open stream..." or "...could not find driver", even though the requirement checker confirms you have PDO and the corresponding database driver.

0 0
1 follower
Viewed: 11 173 times
Version: 1.1
Category: Tutorials
Tags:

Advanced CTabView using CClipWidget

Created 10 years ago by krillzip, updated 7 years ago by Yang He.

Here is a way to dynamically extend tabs based on clips.
Probably even more complex things could be done.

2 0
2 followers
Viewed: 14 747 times
Version: 1.1
Category: Tutorials
Tags:

How to log changes of ActiveRecords?

Created 10 years ago by pfth, updated 7 years ago by Yang He.

A simple and effective way to keep track what your users are doing within your application is to log their activities related to database modifications. You can log whenever a record was inserted, changed or deleted, and also when and by which user this was done. For a [CActiveRecord] Model you could use a behavior for this purpose. This way you will be able to add log functionality to ActiveRecor...

31 1
48 followers
Viewed: 58 742 times
Version: 1.1
Category: Tutorials
Tags: Logging

How to automate timestamps in ActiveRecord models

Created 10 years ago by dalip, updated 7 years ago by Yang He.

There are many ways to automate the setting of timestamps in yii ActiveRecord models. Three are presented here:

25 0
35 followers
Viewed: 162 885 times
Version: 1.1
Category: Tutorials
Tags:

How to filter data using a dropdown list?

Created 10 years ago by qiang, updated 7 years ago by Yang He.

A dropdown list can be used to select a value, based on which we can filter the data to be displayed. For example, the extension page has a dropdown list to filter the displayed extensions according to the selected category.

7 0
6 followers
Viewed: 34 416 times
Version: 1.1
Category: Tutorials
Tags:

How to use Highslide for image popups

Created 10 years ago by mocapapa, updated 8 years ago by wei.

>Highslide JS is an open source JavaScript software, offering a Web 2.0 approach to popup windows. It streamlines the use of thumbnail images and HTML popups on web pages. > > + No plugins like Flash or Java required. > + Popup blockers are no problem. The content expands within the active browser window. > + Single click. After opening the image or HTML popup, the user can scroll further down...

1 0
2 followers
Viewed: 23 150 times
Version: 1.1
Category: Tutorials
Tags: image, popups

Eclipse PDT - code-hints, references and other goodies

Created 10 years ago by mindeh, updated 8 years ago by Woil.

Since PHP is dynamically typed language, the way IDE may help you is limited.

14 0
6 followers
Viewed: 34 751 times
Version: 1.1
Category: Tutorials
Tags: IDE

AutoTimestampBehavior

Created 10 years ago by jonah, updated 7 years ago by Yang He.

This behavior will automatically set timestamp fields to the row creation and modification times.

2 2
3 followers
Viewed: 16 872 times
Version: 1.1
Category: Tutorials
Tags:

How to hide index.php on nginx

Created 10 years ago by miles, updated 8 years ago by Darwin Wen.

For a complete sample Nginx+PHP-FPM config, view this how-to: Nginx & PHP-FPM

4 0
12 followers
Viewed: 71 451 times
Version: 1.1
Category: Tutorials
Tags: URL

How to set up Unicode

Created 10 years ago by Mike, updated 6 years ago by Roman Solomatin.

To fix issues with display of special language characters once and for all there's a solution: use Unicode UTF-8 everywhere. If everything is set up to use Unicode, you can use mostly every language in your application.

19 0
13 followers
Viewed: 109 856 times
Version: 1.1
Category: How-tos
Tags: i18n, unicode

How to make use of a fragment cache

Created 10 years ago by dalip, updated 8 years ago by wei.
1 0
2 followers
Viewed: 13 330 times
Version: 1.1
Category: Tutorials

How to customize Yii core messages?

Created 10 years ago by qiang, updated 7 years ago by Yang He.

Yii core messages refer to static text strings in the core Yii framework code which are meant to be displayed to end-users (e.g. core exception messages, default validation error messages). Customization of these core messages is needed in two circumstances:

17 0
17 followers
Viewed: 58 607 times
Version: 1.1
Category: Tutorials

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

Created 10 years ago by qiang, updated 7 years ago by Yang He.

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:

87 0
78 followers
Viewed: 235 739 times
Version: 1.1
Category: Tutorials

How to generate Web feed for an application

Created 10 years ago by qiang, updated 7 years ago by Yang He.

Web feed is a data format used for providing users with frequently updated content. In this article, we describe how to use Zend_Feed, an excellent component from Zend Framework to generate Web feed for an Yii application. This article can also serve as a general guide...

3 0
9 followers
Viewed: 30 018 times
Version: 1.1
Category: Tutorials
Tags: