Mr.SH Mr.SH - 4 months ago 38
PHP Question

Yii CGridView make url in data column

I am new to Yii and trying to make modify one application which use

zii.widgets.grid.CGridView


I am trying to pass 2 divs in one column and also trying to get URL too.

This is my code:

'value' => 'CHtml::tag("div", array("class"=>""),
"<div class=cname>.$data->name."</div>".
"<br><div class=cname1> Status | Copy "."</div>"
)',


In the above I want to put link to Status and Copy

The code which generate URL is this:

'value' => 'CHtml::link($data->id, Yii::app()->createUrl("overview/cam", array("uid" => $data->id)))',


I have tried many options but nothing is working.

Thanks

Answer

You should try 'url' instead of 'value' in CGridView

'url'=>'Yii::app()->createUrl("overview/cam", array("uid" => $data->id))',

If you use value then do something like this..

 'value'=>CHtml::link('$data->id,array('overview/cam','uid'=>$data->id));