Cdetailview

Hi gyz, how can I add a condition in an attribute of CDetailView so that attribute will display what is based on that conditions e.g. if that attribute is gona hold values N or M then if the value is N it displays ‘Nortingam’ and if value is M it displays ‘Madrid’? Any help? Thanks.

Hi Donatus

You can do it like that

$this->widget(‘zii.widgets.CDetailView’, array(

‘data’=>$model,

'attributes'=>array(


    // ...


    array(


        'name'=>'yourfield',


        'label'=>'your label',


        'value'=>'$data->yourfield=="N" ? "North" : "East") //$data is for each one of $model record


    ),


),

)