Wiki

Articles in category "tips", sorted by viewsX
Displaying 41-50 of 102 result(s).

Customize CGridView columns directly in your view

Created 10 months ago by clapasTips2 comments – viewed 10,122 times – ( +2 / -1 )
You usually take a model instance passed into your view to provide data to a CGridView in this way:

Yii Security-extended guide

Created about a year ago by bingjie2680Tips11 comments – viewed 10,095 times – ( +6 / -6 )
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.

A simple action for XUpload extension

Created 2 years ago by tydeas_drTips1 comment – viewed 9,913 times – ( +3 )
All the basic functionality for an action used by the xupload extension. Check resources for the source code of this action
tags: tips, xupload, caction

Using cache in CActiveDataProvider

Created about a year ago by StammTips7 comments – viewed 9,506 times – ( +17 )
First param in CActiveDataProvider could be a string with model name or instance of class. So, you may use CActiveRecord::cache() for cache, but you need set third param to 2, because you should cache 2 queries: counting and get data.

Auto TDD - How to auto-run PHPUnit

Created 2 years ago by imeheszTips3 comments – viewed 9,356 times – ( +3 )
If you are lucky enough and have the privilege to develop on a Linux based environment, this little tip might boost-up your TDD process (at least the Unit Testing part). Please note, that this should work just fine with Apple computers also, but not tested!
tags: PHPUnit, testing, TDD

A simple class to use a different db for a module

Created 2 years ago by tydeas_drTips2 comments – viewed 8,809 times – ( +8 )
What would you do if you want/need to have a different than the main database connection in an module's models?

Extending CActiveForm for some form display fixes and language tweaks

Created 2 years ago by TrejderTips0 comments – viewed 8,759 times – ( +5 )
In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.

Customizing Yii's formatting rules (extending CFormatter)

Created about a year ago by HaenselTips0 comments – viewed 8,694 times – ( +14 )
CFormatter is one of Yii's core components and used to format values displayed in widgets like CGridView or CDetailView. All classic formats like numbers, text, urls or datetime are supported but you may have to use a formatting rule that isn't built in. Let's say we want to display arrays of strings (like tags associated with a product model). When using CDetailView we would usually make use of PHPs implode function to create a simple string value of all values in the $product->tags array.

Using MBMenu and Rights to automatically create menu item for your modules

Created 2 years ago by dinhtrungTips2 comments – viewed 8,416 times – ( +1 / -1 )
Using Rights generator component, we can easily create a dynamic menu, in which we scan every modules' controllers, to access the index page of them.

How to ensure unicity to url

Created about a year ago by zaccariaTips3 comments – viewed 8,354 times – ( +14 )
Many time for SEO porpouses is important that each page will have a unique address.
tags: SEO, unique, URL