The above works without quotes around $model->id. If I put quotes, it does not work.
When to use simple quotes and when to use double quotes. I haven’t figured out how to use them. At times, if I put quotes(simple or double), it does not work at all. But at times, I must use quotes for it to work.
To summarize, “$something” in double quotes is treated as a variable and will be expanded, while ‘$something’ in single quotes is treated as a literal string:
We usually use a single-quoted string that contains ‘$data’ when we set CDataColumn::value, because we want to pass the literal string of ‘$data’ to it.
CDataColumn::value is an “expression” string that is to be passed to “eval()” function each time the cell get displayed. And once it is passed to eval(), ‘$data’ in the expression will be treated as a variable.
CGridView will populate $data with the data model of the row each time before it calls eval(). So, for example, the expression of ‘$data->name’ will return ‘name’ attribute of the model when it is eval()ed.
But until eval()ed, we don’t want $data to be expanded as a variable.