CGridView and functions in row values

I haven’t yet understood what kind of functionalities you can include in Gridview values.

I have list of photo Id’s and in every Id there are included the photo thumbmail path also to include thumbmail image into to the list. So, in every row I have to parse the id String and generate the image path according

to the id.

So, the major question is, how can I include operations such like a funtions to in to the value variable in CGridview.

I’m trying to do it like this and i know there will be problems in this code:


	$leadingPath = "/images/uploads";

	$path = Yii::app()->getRequest()->getScriptFile();

	$path = substr($path, 0, count($path) - 10);


	$filename = $path.'protected/controllers/SiteController.php';	

	$commandString = "require_once(".$filename.");"; //I need SiteController becouse there is one important function what I need to use.

	$commandString .= '$imagePath = SiteController::getRealName($data->idPhoto);'; //getting the path of image accordint to img id.

	$commandString .='echo \'<img src="'.Yii::app()->request->baseUrl.$leadingPath.'\'.$imagePath.\'">;\''; 


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








		array('header'=>'img', 'value'=>$commandString),//so here should be various of thumbmail images printed

		array('header'=>'kuva',  'value'=> '($data->idPhoto == "0" ? "" : "on")'),










)); ?>

Hello, create a behavior class that houses the function in quote then attach the behavior class to your "image model class", if u call (the function) it in the CGridview it will be perfect.

i have the issue as u and this is what i did.