Wiki articles

Showing 261-280 of 822 items.

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: 309 935 times
Version: 1.1
Category: How-tos

Simple authorization system

Created 12 years ago by Gustavo, updated 10 years ago by Gustavo.

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

14 0
17 followers
Viewed: 44 783 times
Version: 1.1
Category: How-tos

Model password confirmation field.

Created 12 years ago by twisted1919, updated 11 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
19 followers
Viewed: 93 964 times
Version: 1.1
Category: How-tos

CGridView: Render customized/complex datacolumns

Created 12 years ago by Joblo, updated 11 years ago by Joblo.

If you have to display a overview of related data in a table, you can use the CListView, create your view with table/tr/td tags and implement db-queries in the view to display detaildata of the current (master-)record.

53 0
74 followers
Viewed: 168 145 times
Version: 1.1
Category: Tips
Tags: CGridView

How to use Flash, Zend AMF and Yii Framework

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

This is a simple demo how to use Zend_AMF with Yii.

3 0
6 followers
Viewed: 15 807 times
Version: 1.1
Category: Tutorials

1:n relations sometimes require CDbCriteria.together

Created 12 years ago by fsb, updated 10 years ago by fsb.

There are situations in which Active Record will generate nonsense queries from what a nieve Yii user might think is reasonable code. One such situation is a CActiveDataProvider using CDbCriteria to get data from parent and 1:n child table with a condition on the child table.

15 0
12 followers
Viewed: 51 323 times
Version: 1.1
Category: Tips

Searching and sorting by related model in CGridView

Created 12 years ago by Maciej Liżewski, updated 9 years ago by Kostas Apazidis (KonApaz).

Lets say we have two models and relation between them:

77 0
93 followers
Viewed: 273 331 times
Version: 1.1
Category: Tutorials

Using counters with ActiveRecord

Created 12 years ago by davi_alexandre, updated 9 years ago by marcovtwout.

Let's say, for example, that you are developing a blog or some kind of CMS and you want to track the number of times each post was viewed (maybe to show a list of the most viewed ones).

11 1
17 followers
Viewed: 44 625 times
Version: 1.1
Category: Tips

Secure password hash storage and a Yii helper extension

Created 12 years ago by fsb, updated 10 years ago by fsb.

This wiki has been replaced by Use crypt() for password storage.

13 0
13 followers
Viewed: 38 642 times
Version: 1.1
Category: Tutorials

Rendering a view file in a console application

Created 12 years ago by Tompi, updated 12 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: 19 854 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 504 times
Version: 1.1
Category: How-tos

The Comedy of Errors

Created 12 years ago by fsb, updated 10 years ago by Mike.

Please join the party by adding your own favorite Yii programming errors. Be sure to leave at least a hint at the correction.

19 0
15 followers
Viewed: 18 974 times
Version: 1.1
Category: Others

Front-end developer's guide

Created 12 years ago by jonah, updated 12 years ago by waitekk.

This wiki is a work in progress.

10 0
19 followers
Viewed: 40 573 times
Version: 1.1
Category: Tutorials

Managing constants easily

Created 12 years ago by briiC.lv, updated 12 years ago by briiC.lv.

/*

    Get class constants by token.
    If you set constants with same prefix, like:
	MY_STATUS_1
	MY_STATUS_2
	MY_STATUS_3
4 0
7 followers
Viewed: 30 663 times
Version: 1.1
Category: Tips

Use application on production/development environment without making changes

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

I like programing on my localhost, however it really bugged me to make changes to index.php & config files on my production server. After combining all available wiki articles on this topic and some trial and error this is what I use for my applications so I could just upload it to production server and it will work without any changes.

8 1
11 followers
Viewed: 76 756 times
Version: 1.1
Category: Tips

Change buttons on our CGridView extending yii

Created 12 years ago by sensorario, updated 11 years ago by sensorario.

In this tip, I'll help you to change in few second buttons of your CGridView. I hope you like it =).

9 0
9 followers
Viewed: 35 853 times
Version: 1.1
Category: Tips

Update two models with one view

Created 12 years ago by sensorario, updated 11 years ago by SebK.

Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).

9 3
13 followers
Viewed: 55 447 times
Version: 1.1
Category: Tips

Secure password hashing with bCrypt

Created 12 years ago by waitforit, updated 11 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: 37 143 times
Version: 1.1
Category: How-tos

Manage (Target) Language in Multilingual Applications + A Language Selector Widget (i18n)

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

In case of a multilingual application, one might consider it a reasonable approach to store the preferred language of the user in a session variable, and after that, every time a page is requested, to check this session variable and render the page in the indicated language. This tutorial shows a Yii-way of doing this.
We implement an event handler for the onBeginRequest event; as the nam...

9 0
19 followers
Viewed: 49 694 times
Version: 1.1
Category: Tutorials

SEO-conform Multilingual URLs + Language Selector Widget (i18n)

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

You have a multilingual application, and you want the URL of a page to be different for different languages, to account for SEO. The URL for the contact page for example should look like http://something.com/en/contact in english, and http://something.com/de/contact in german. This tutorial describes how to make it happen.
Note that currently selected language is always a part...

28 0
42 followers
Viewed: 75 879 times
Version: 1.1
Category: Tutorials