Wiki

Articles tagged with "cformatter"X
Displaying 1-2 of 2 result(s).

How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView

Created 2 years ago by c@cbaHow-tos3 comments – viewed 9,643 times – ( +9 ) – version 1.1
As you know, the CDetailView widget displays details of a single model. If no formatting is specified, boolean values that are stored in the database as 0 and 1, are represented in the detail view as 0 and 1. If formatted as boolean, they are represented as 'No' and 'Yes'. We want to add i18n support, so that Yes and No appear in the current language.

Customizing Yii's formatting rules (extending CFormatter)

Created 3 years ago by HaenselTips0 comments – viewed 13,507 times – ( +14 ) – version 1.1
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.