Modify content in CGridView ?

Is there anyway to make it cleaner and not let it use eval?




<?php

$this->widget('zii.widgets.grid.CGridView', array(

	'dataProvider'=> $dataProvider,

	'columns'=>array(

		'id',

		'title',

		'directory',

		'created',


        array(

            'name' => 'description',

            'value' => 'CString::truncate($data->description)',

        ),

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>



What is going to happend where there is some php code in description :s

Is there any benefit over just using a foreach loop which makes the code much more readable?

Nothing. Not $data->description will get eval’ed but only the code you wrote that uses this variable.