Wiki

Articles in category "tips"X
Displaying 81-90 of 139 result(s).

Managing constants easily

Created 2 years ago by briiC.lvTips4 comments – viewed 10,622 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 19,995 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 2 years ago by fsbTips5 comments – viewed 26,345 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 114,837 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 2 years ago by bingjie2680Tips11 comments – viewed 15,077 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 3 years ago by GOshaTips0 comments – viewed 7,932 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 3 years ago by JobloTips11 comments – viewed 38,044 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'.

CGridView: Display the full record (actionView) in a CJuiDialog

Created 3 years ago by JobloTips7 comments – viewed 35,367 times – ( +15 ) – version 1.1
If you show a model (with a lot of attributes) partially in a CGridView, it can be helpful when the user can take a quick look at the full record with all attributes without displaying the view as a page and afterwards returning back to the gridview.

Using events with CAction classes

Created 3 years ago by Antonio RamirezTips0 comments – viewed 11,093 times – ( +9 ) – version 1.1
There are some good guides out there explaining how to work with events and the ways to attach them to your components, but none (that I know) explain the following way to configure your events with CAction classes on your controllers the following way.

Como trasponer una lista creada con CHtml::checkBoxList

Created 3 years ago by rdjteamTips3 comments – viewed 9,026 times – ( +2 ) – version 1.1
En ciertas ocasiones tenemos que lidiar con el tema de colocar una lista de checkboxes para hacer una seleccion especifica como es el caso de los dias de la semana para un calendario, para esta labor tenemos el comando CHtml::checkBoxList(), revisando un poco el funcionamiento de este temos los siguientes parametros: