Wiki

Articles in category "tips", sorted by viewsX
Displaying 61-70 of 137 result(s).

How to ensure unicity to url

Created 3 years ago by zaccariaTips3 comments – viewed 10,631 times – ( +14 ) – version 1.1
Many time for SEO porpouses is important that each page will have a unique address.
tags: SEO, unique, URL

URL component access functions

Created 3 years ago by Steve FriedlTips1 comment – viewed 10,585 times – ( +28 ) – version 1.1
Many applications wish to obtain parts of the URL for the current page (the hostname, the query string, etc.), and the CHttpRequest class wraps various $_SERVER variables to break down the URL into its constituent parts.
tags: URL, request

Managing constants easily

Created 2 years ago by briiC.lvTips4 comments – viewed 10,572 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.

Debugging CActiveRecord failed save() attempts

Created about a year ago by BoazTips0 comments – viewed 10,139 times – ( +4 ) – version 1.1
When you're filling up a form of a CActiveRecord (using CActiveForm for example), usually you'll construct your code so that in case of validation error you'll get back the form with the error displayed back to you, typically when CActiveForm.errorSummary() is used. This is how its done by Gii.

ChromePHP for Yii

Created 3 years ago by imeheszTips0 comments – viewed 9,792 times – ( +3 / -2 ) – version 1.1
ChromePHP is a console logging extension for Google Chrome.

Yii code completion and calltips in Komodo Edit

Created 3 years ago by viterTips1 comment – viewed 9,640 times – ( +6 ) – version 1.1
My favourite editor is Komodo Edit (free and crossplatform) and I use it for my everyday coding work. Just recently I found out how to make it help me to work with Yii. :) So follow these steps:
tags: Komodo Edit

Adding 'disabled' to CCheckBoxColumn and support for yiigridview.js

Created about a year ago by Xgamer99Tips3 comments – viewed 9,392 times – ( +1 ) – version 1.1
I recently had to have a checkbox column in my grid view that supported the 'disabled' attribute. This was easy enough to do by extending the CCheckBoxColumn. However, I also wanted the checkbox to be selected when clicking on the table's row (supported via CGridView's selectableRows option). I discovered I had to tweak yiigridview.js so that it would not select disabled rows when clicking on it or on the 'select all' checkbox.

Getting nulls from database instead of empty strings

Created 3 years ago by samdarkTips2 comments – viewed 9,202 times – ( +13 ) – version 1.1
To get null from database instead of empty strings you need to set up your DB connection as follows:
tags: database, null

Using CListView to display items next to each other (in columns)

Created about a year ago by thyseusTips3 comments – viewed 9,148 times – ( +11 )
When using CListView to display multiple views next to each other, we can use the $index variable inside the viewFile to achieve this. As far as i know there is no extension or out-of-the-box functionality for this, so we need to apply a little hack:

Adding a link to a CDataColumn

Created about a year ago by le_topTips6 comments – viewed 9,045 times – ( +3 ) – version 1.1
Backoffice Grid Views often list information like Posts for a blog while showing at the same time linked information like the User who wrote that post. For more efficiency, it is appropriate that the User is displayed as a link to the User detail page.