Wiki

Articles in category "tips"X
Displaying 91-100 of 152 result(s).

Update two models with one view

Created 4 years ago by sensorarioTips11 comments – viewed 38,803 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 4 years ago by sensorarioTips6 comments – viewed 27,754 times – ( +12 ) – 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 4 years ago by ifdatticTips3 comments – viewed 44,876 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 4 years ago by briiC.lvTips4 comments – viewed 14,332 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 4 years ago by davi_alexandreTips9 comments – viewed 27,198 times – ( +14 / -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 4 years ago by fsbTips5 comments – viewed 35,457 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 4 years ago by JobloTips13 comments – viewed 144,209 times – ( +73 ) – 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 4 years ago by bingjie2680Tips11 comments – viewed 18,695 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 4 years ago by GOshaTips0 comments – viewed 9,212 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 4 years ago by JobloTips12 comments – viewed 46,098 times – ( +14 ) – 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'.