sas1ni69
(Sas1ni69)
1
Hi guys,
I’m trying to change the listview to display a bunch of images and descriptions like google images. Say 3 pictures per row.
How do I go about that?
I’m sorry if this sounds like a silly question but I really tried searching for the answer on my own but I couldn’t =\ Thanks in advance.
Jesse
(Jmcowell)
2
Hi, this is what I use for images on the CGridView - I hope this helps someone.
<?PHP
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
//LINK EXAMPLE
array(
'name'=>'A Link',
'type'=>'raw',
'value'=>'CHtml::link(CHtml::encode($data->linkTitle), array("MODEL/update", "id"=>$data->id))'
),
//IMAGE EXAMPLE
array(
'name'=>'image1',
'type'=>'html',
'value'=>'CHtml::image( Yii::app()->request->baseUrl."/images/".$data->image1, "image1", array("width"=>30) )'
),
array(
'class'=>'CButtonColumn',
),
),
));
?>