Wiki articles in category How-tos

Showing 201-220 of 292 items.

CGridView keep focus on the control after filtering

Created 7 years ago by jayala, updated 7 years ago by jayala.

You can find the reason why I wrote this article here.

5 0
10 followers
Viewed: 13 732 times
Version: 1.1
Category: How-tos

How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView

Created 7 years ago by c@cba, updated 7 years ago by c@cba.

As you know, the CDetailView widget displays details of a single model. If no formatting is specified, boolean values that are stored in the database as 0 and 1, are represented in the detail view as 0 and 1. If formatted as boolean, they are represented as 'No' and 'Yes'. We want to add i18n support, so that Yes and No appear in the current language.

9 0
9 followers
Viewed: 15 181 times
Version: 1.1
Category: How-tos

Drop down list with enum values for column of type ENUM >+> incorporate into giix

Created 7 years ago by c@cba, updated 5 years ago by nsanden.

Let's say our table 'mug' has a column named 'color' of the type ENUM('red','green','blue').
We want to replace the textfield for the attribute color in the create and update forms of a 'mug' with a drop down list, which has the enum values as options.
The main code was contributed by zaccaria in the forum (see [this post](...

10 0
11 followers
Viewed: 42 273 times
Version: 1.1
Category: How-tos

How to obtain a grammatically correct translation of the model name in giix-generated view files

Created 7 years ago by c@cba, updated 7 years ago by c@cba.

The giix code generator has out of the box i18n support for model names and attribute labels (besides other cool features > check it out!) .
But I want to factor in not only the plural form, but also the grammatical cases (especially the accusative) while translating 'Manage Objects', 'Create Object', 'Edit Object' etc.

4 0
1 follower
Viewed: 14 353 times
Version: 1.1
Category: How-tos

History Autocomplete

Created 7 years ago by zaccaria, updated 7 years ago by Maurizio Domba Cerin.

In application development we often have to choose how to mange recurrent values.

3 0
9 followers
Viewed: 10 772 times
Version: 1.1
Category: How-tos

How to handle decimal separators (e.g comma instead of dot) for l18n

Created 7 years ago by jpablo, updated 7 years ago by jpablo.

Yii i18n does not cover decimal format. Some languages like Spanish (I live in Argentina) uses comma ',' instead of dot '.' as decimal separator.

2 0
10 followers
Viewed: 18 797 times
Version: 1.1
Category: How-tos
Tags:

Tarpit for bad bots

Created 7 years ago by mithereal, updated 7 years ago by mithereal.

I recently built a tarpit for bad bots.

1 0
9 followers
Viewed: 8 363 times
Version: 1.1
Category: How-tos
Tags: bots, tarpit

Database driven Cmenu

Created 7 years ago by twisted1919, updated 7 years ago by twisted1919.

This is a simple example that will give you a base for designing a database driven menu system that will use CMenu to be rendered.

12 0
17 followers
Viewed: 28 511 times
Version: 1.1
Category: How-tos

Secure password hashing with bCrypt

Created 7 years ago by waitforit, updated 6 years ago by Ivo Pereira.

In this article I will show you how to implement a secure password hashing mechanism in your Yii projects using a bCrypt class.

5 0
9 followers
Viewed: 28 029 times
Version: 1.1
Category: How-tos

Accessing data in a join table with the related models

Created 7 years ago by fsb, updated 6 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: 129 152 times
Version: 1.1
Category: How-tos

Rendering a view file in a console application

Created 7 years ago by Tompi, updated 7 years ago by Tompi.

When someone want to send formatted HTML mails from a console application she/he will probably come across the problem of rendering view files.

2 1
7 followers
Viewed: 15 992 times
Version: 1.1
Category: How-tos

Model password confirmation field.

Created 7 years ago by twisted1919, updated 7 years ago by PashaL.

I had some troubles with the password confirmation field for when adding updating user records, so i thought that i should share the way i got it working.

8 0
20 followers
Viewed: 80 790 times
Version: 1.1
Category: How-tos

Simple authorization system

Created 7 years ago by Gustavo, updated 6 years ago by Gustavo.

How to create a simple (non-RBAC) authorization system

14 0
17 followers
Viewed: 38 561 times
Version: 1.1
Category: How-tos

How to write secure Yii applications

Created 7 years ago by François Gannaz, updated 5 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
117 followers
Viewed: 264 113 times
Version: 1.1
Category: How-tos

How to validate CSRF token with session

Created 7 years ago by yangmls, updated 7 years ago by yangmls.

First of all, You must change component config to enable the default Yii CSRF validation.

20 0
27 followers
Viewed: 70 296 times
Version: 1.1
Category: How-tos
Tags: CSRF, session

How to re enable logging during unit testing

Created 7 years ago by Asgaroth, updated 7 years ago by Asgaroth.

Some of you have experienced the need to log some information while doing unit testing, due to the fact that the information given in the summary is just not enough, to know why the test is actually failing. this article focuses on 2 ways to get you logs up and running again.

11 0
10 followers
Viewed: 19 773 times
Version: 1.1
Category: How-tos

How to insert a Simple Dialog Box

Created 7 years ago by bluyell, updated 7 years ago by bluyell.

I build this simple PHP class (DialogBox.php at the bottom of this wiki) to help you in the dialog box usage on Yii applications. The goal is run any Yii actions into this dialog box and return the resulting value to the calling instance.

5 0
10 followers
Viewed: 33 305 times
Version: 1.1
Category: How-tos

File uploads in CForm (Form builder)

Created 7 years ago by Luke Jurgs, updated 7 years ago by Luke Jurgs.

While there is a reasonable amount of documentation regarding CForm (form builder) and file uploads seperately, there really is not any coverage of both in combination.

9 0
10 followers
Viewed: 47 013 times
Version: 1.1
Category: How-tos

CPhpAuthManager - how it works, and when to use it

Created 7 years ago by dckurushin, updated 7 years ago by François Gannaz.

It is actually mentioned in the documentation

1 2
6 followers
Viewed: 26 627 times
Version: 1.1
Category: How-tos

Reliable Alternative For Yii::app()->request->isAjaxRequest AND Adding Data To Ajax Form With JS

Created 7 years ago by ibo_s, updated 7 years ago by ibo_s.

In this How-To I'll show you:

12 1
11 followers
Viewed: 54 197 times
Version: 1.1
Category: How-tos