How To Create A Url In Yii Using Value Of A Variable

I’m using this lines to create a URL for update button.

[b]'url'=>'$this->grid->controller->createUrl("/testSettings/update", array("id"=>$data->Id,"approval"=>0))' [/b]

This works fine as I have hardcoded the value for approval. Now I have to change this 0 with value of another variable $approval. How can I do this.

i.e I have to give this

‘url’=>’$this->grid->controller->createUrl("/testSettings/update", array(“id”=>$data->Id,“approval”=>$approval))’

you may something look like this

for example…


'url'=>'Yii::app()->createUrl(\'vendor/events/eventupdatetab\', array(\'id\'=>$data["id"],\'type\'=>$data["event_type"]))',

It is resulting in syntax error

‘url’=>’$this->grid->controller->createUrl("/testSettings/update", array(“id”=>$data->Id,“approval”=isApproved()))’

This worked fine for me

you can try this


"approval"=>"'.$approval.'"