Yii Framework Forum: Yii View, Replacing Some Database Status Values 0,1 As Active Or In Active - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii View, Replacing Some Database Status Values 0,1 As Active Or In Active Rate Topic: ***** 1 Votes

#1 User is offline   Muhammad Shahzad 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 58
  • Joined: 29-January 13
  • Location:Islamabad,Pakistan

Posted 13 February 2013 - 03:06 AM

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.
0

#2 User is offline   ragua 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 135
  • Joined: 23-January 12
  • Location:Paris - France

Posted 13 February 2013 - 03:36 AM

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',
        ),

1

#3 User is offline   Muhammad Shahzad 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 58
  • Joined: 29-January 13
  • Location:Islamabad,Pakistan

Posted 13 February 2013 - 04:21 AM

Thanks ragua. now its working fine.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users