Wiki articles in category How-tos

Showing 1-20 of 292 items.

Reference: Model rules validation

Created 14 years ago by krillzip, updated 10 years ago by Rodrigo.

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 followers
Viewed: 885 009 times
Version: 1.1
Category: How-tos

How-To: Create a REST API

Created 13 years ago by jwerner, updated 9 years ago by Rohit Suthar.

This article will explain how to create a REST API with the Yii framework.

98 2
123 followers
Viewed: 498 338 times
Version: 1.1
Category: How-tos

Using CButtonColumn to customize buttons in CGridView

Created 13 years ago by Trejder, updated 11 years ago by Gismo.

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 followers
Viewed: 344 701 times
Version: 1.1
Category: How-tos

Url: hide index.php

Created 12 years ago by Hermans, updated 12 years ago by Hermans.

Maybe it looks simple, but some time ago I need some time to find a solution of this case. I finally got it, and I want to share that I also experienced such cases. So that it can make reference.

19 0
31 followers
Viewed: 316 101 times
Version: 1.1
Category: How-tos

How to write secure Yii1 applications

Created 12 years ago by François Gannaz, updated 2 years ago by François Gannaz.
  • 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 followers
Viewed: 310 885 times
Version: 1.1
Category: How-tos

Multiple files uploader with CMultiFileUpload

Created 10 years ago by Interboy, updated 5 years ago by samdark.

Today I will show you how to handle multiple file upload step by step.

5 0
8 followers
Viewed: 281 117 times
Version: 1.1
Category: How-tos

Create your own Validation Rule

Created 13 years ago by nickcv, updated 11 years ago by Gismo.

Some times the core validation rules provided by Yii won't satisfy all your needs, so you'll need to create your very own validation rule.

59 0
54 followers
Viewed: 272 568 times
Version: 1.1
Category: How-tos

Cookie management in Yii

Created 13 years ago by Trejder, updated 11 years ago by resurtm.

Cookie management in Yii is easy, but may not be so obvious for the beginners to this framework, so I wrote this simple article to clear some doubts out.

38 1
40 followers
Viewed: 193 297 times
Version: 1.1
Category: How-tos

Javascript and AJAX with Yii

Created 11 years ago by François Gannaz, updated 10 years ago by François Gannaz.

This page intends to provide an exhaustive guide of how to use Javascript (JS) in Yii. It does not explain how to learn coding in JS, but how to deal with it "the Yii way".

23 0
30 followers
Viewed: 180 451 times
Version: 1.1
Category: How-tos

Creating and updating model and its related models in one form, inc. image

Created 11 years ago by Boaz, updated 11 years ago by Boaz.

We start slowly and simple...

6 1
21 followers
Viewed: 169 682 times
Version: 1.1
Category: How-tos

Accessing data in a join table with the related models

Created 12 years ago by fsb, updated 11 years ago by krowe.

Sometimes the right place to store application data is in a join table. For example, movie viewers either like or don’t like the movies they watched.

16 1
30 followers
Viewed: 146 513 times
Version: 1.1
Category: How-tos

Setting and getting systemwide static parameters

Created 13 years ago by Steve Friedl, updated 13 years ago by Steve Friedl.

Occasionally one wishes to set systemwide parameters for an application, such as a contact address for email, an application name, or setting an option that guides major behavior. Yii provides for setting of static parameters in the configuration file, and this article talks about how to do it conveniently.

11 0
12 followers
Viewed: 146 258 times
Version: 1.1
Category: How-tos
Tags: config

Multiple-database support in Yii

Created 13 years ago by Steve Friedl, updated 11 years ago by phazei.

The customary configuration of a Yii application includes just a single database section in the protected/config/main.php file, but it's easy to extend this to support more than one, tying each Model to one of the databases.

20 0
39 followers
Viewed: 144 314 times
Version: 1.1
Category: How-tos
Tags: database

Date Picker by examples

Created 10 years ago by Interboy, updated 8 years ago by Alfa Adhitya.

CJuiDatePicker displays a datepicker. CJuiDatePicker encapsulates the JUI datepicker plugin.

6 0
7 followers
Viewed: 139 526 times
Version: 1.1
Category: How-tos

How to use PHPExcel external library with Yii

Created 13 years ago by Antonio Ramirez, updated 10 years ago by cgsmith.

Trying to learn and help some other programmers to find their solutions on the Yii Forum (I think is a superb way to learn the framework), I was facing one challenge with an external library that a fellow programmer wanted to use -quite good indeed: PHPExcel. And what is PHPExcel?

27 1
25 followers
Viewed: 138 718 times
Version: 1.1
Category: How-tos

How to set up Unicode

Created 15 years ago by Mike, updated 10 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
14 followers
Viewed: 135 852 times
Version: 1.1
Category: How-tos
Tags: i18n, unicode

Uploading multiple images with CMultiFileUpload

Created 13 years ago by rsingh, updated 13 years ago by Maurizio Domba Cerin.
33 0
38 followers
Viewed: 129 801 times
Version: 1.1
Category: How-tos

X-Sendfile - serve large static files efficiently from web applications

Created 13 years ago by Maurizio Domba Cerin, updated 12 years ago by Maurizio Domba Cerin.

Normally when we want users to download a file, that file is put in a folder under the web application root and the web server does the rest.

29 0
20 followers
Viewed: 119 930 times
Version: 1.1
Category: How-tos

Implementing cron jobs with Yii

Created 13 years ago by samdark, updated 13 years ago by samdark.

There are two ways to run a cron job:

27 2
27 followers
Viewed: 114 021 times
Version: 1.1
Category: How-tos
Tags: cli, cron

How to setup RBAC with a php file

Created 14 years ago by bettor, updated 11 years ago by Stageline.

In this cookbook I will attempt to explain how to use the lightweight version of Role-Based Access Control using a php file. This version does not use database but a php file and is controlled by CPhpAuthManager class.

24 4
21 followers
Viewed: 111 255 times
Version: 1.1
Category: How-tos