CGridview custom display using Public or Private as values

Description of a column in CGridView




		'value'=>'($data->public)' ? 'Public':'Private',		


returns the following error

Parse error: parse error in D:\xampp\htdocs\yii\framework\base\CComponent.php(616) : eval()'d code on line 1

because ‘value’ is evaluated… you have to put all your “code” as an string expression like

'value'=>' ($data->public) ? "Public":"Private" ',		

Note that all the expression is as one string.

You should write:

'value'=>'$data->public ? "Public" : "Private"',	

The way you wrote it, ‘($data->public)’ was evaluated to true, so it was like saying:


EDIT: Hehe, mdomba was faster again ;)

Sorry, you’re right. Thank you guys. It works.

Love Yii !