Yii View, Replacing Some Database Status Values 0,1 As Active Or In Active

Hi Everyone,

I want to Yii View, Replacing some database values in view.

for example in database table i have 1 field of status and its value is ‘0’ or ‘1’ but in View I want to display as ‘0’=>‘In Active’ or ‘1’=>‘Active’.

I am using this code in action view:




array( 

       'name'=>'isrecurring',		

	'value'=>'($data->isrecurring == \'1\') ? "Active " : "In Active"',

	'type'=>'raw',

	),



but it’s not working.

In action admin its work fine and show Active or In Active.

Hi,

i think quote are used for CGridView, there’s no need for CDetailView, so you can try:




array( 

       'name'=>'isrecurring',           

        'value'=>($data->isrecurring == '1') ? "Active " : "In Active",

        'type'=>'raw',

        ),



Thanks ragua. now its working fine.