I have some problems rendering an image in CGridView. I have the following code:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
array(
'name'=>'Flag',
'type'=>'image',
'value'=>'CHtml::image("images/flags/".$data->country.".gif", "country")',
),
),
));$data->country contains the name of a country from my DB. So I have added the path and the extension of the image. However, the above code renders the following html:
<img alt="" src="<img src="images/flags/England.gif" alt="country" />"/>
I have found a solution to the problem by either declaring
'type'=>'raw',
or
'type'=>'html',
...but would like to know how to use the image type as I would like to use the proper settings of the framework.
Is there a bug in the code that is supposed to render an image or is there a bug in my head that has missed something in the above code making it not work?
Cheers,
b
Edit: The code is supposed to render the flag of the respective country.

Sign In
Register
Help




MultiQuote
