Wiki

Articles in category "tips"X
Displaying 61-70 of 122 result(s).

Update two models with one view

Created 2 years ago by sensorarioTips10 comments – viewed 27,828 times – ( +10 / -2 ) – version 1.1
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).
tags: database, model, view, form

Change buttons on our CGridView extending yii

Created 2 years ago by sensorarioTips5 comments – viewed 20,994 times – ( +10 ) – version 1.1
In this tip, I'll help you to change in few second buttons of your CGridView. I hope you like it =).

Use application on production/development environment without making changes

Created 2 years ago by ifdatticTips3 comments – viewed 26,735 times – ( +8 / -1 ) – version 1.1
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.

Managing constants easily

Created 2 years ago by briiC.lvTips4 comments – viewed 9,071 times – ( +4 ) – version 1.1
For time to time i have models with constants (basicly status constants) which i use in diferent places and if these constant changes, i have to change mentions of constant in code elsewhere.

Using counters with ActiveRecord

Created 2 years ago by davi_alexandreTips8 comments – viewed 16,841 times – ( +13 / -1 ) – version 1.1
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).

1:n relations sometimes require CDbCriteria.together

Created 2 years ago by fsbTips4 comments – viewed 22,091 times – ( +16 ) – version 1.1
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.

CGridView: Render customized/complex datacolumns

Created 2 years ago by JobloTips13 comments – viewed 99,410 times – ( +69 ) – version 1.1
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.
tags: CGridView

Yii Security-extended guide

Created 2 years ago by bingjie2680Tips11 comments – viewed 13,383 times – ( +6 / -6 ) – version 1.1
This article is called extended guide is because there is already a security guide in the Yii tutorial security section. but that guide is not complete in the sense that it does not rise the developers' attention to some other commonly happening attacks: SQL injection and magic URL, which can be major vulnerabilities in your application without much caring.

Understanding series articles

Created 2 years ago by GOshaTips0 comments – viewed 7,494 times – ( +16 ) – version 1.1
Here are all wiki articles from "Understanding" series by Yii wiki contributors:

CGridView: Update/create records in a CJuiDialog

Created 2 years ago by JobloTips11 comments – viewed 32,397 times – ( +13 ) – version 1.1
My article Display the full record in a CJuiDialog uses ajax to view a record in dialog on clicking the 'view-icon'.