I have following code in my view:
<?php $this->widget('zii.widgets.CDetailView', array(
'data' => $model,
'attributes' => array(
'id',
'name',
array(
'label' => 'Company',
'type' => 'raw',
'value' => 'CJSON::decode($data->json)["Block"]["p_1"]',
),
),
)); ?>
I have field called json in my database. This field contains json formatted data. I used following code in order to decode json data:
array( 'label' => 'Company',
'type'=>'raw',
'value' =>'CJSON::decode($data->json)["Block"]["p_1"]',
),
When I used this json decoding code in CGridView it worked and returned desired value. However, when I used this code in CDetailView, it did not work. The widget returned this code CJSON::decode($data->json)["Block"]["p_1"]
instead of decoded data. How can I decode json data in CDetailView?