Help I have been surfing all day and can not find the topic, how to display multiple images in CDetailView. My situation are as follows:
I have tried with this script:
array(
'name'=>'File Link',
'type'=>'raw',
'value'=> Links of abc,
xyz,
and also this to display the images
$document= CHtml::encode($model->Document);
$file = str_getcsv($document ,",");
in CDetailView
array(
'name'=>'Image',
'type'=>'raw',
'value'=>link to $file[1]
),
array(
'name'=>'Image',
'type'=>'raw',
'value'=>link to $file[2]
),
array(
'name'=>'Image',
'type'=>'raw',
'value'=>link to $file[3]
),
but the result is not as I expected, when I click the link unrecognized opened by the browser.
I expect result like this: and it should be in Dynamic form may be using 'foreach' statement how to use it i m not getting it ... ...
File Link : abc.jpg
xyz.jpg
abaca.jpg <== each must be clickable to the location of the image
... ...
Please Help Regards
sandeep
If I understand your point, you need to have multiple images per row, right?
have a unanymouse function for value attribute and return the link of images:
'value' => function($data){ // here $data represents your model
$link = '';
if(!empty($data->images))
foreach($data->links as $l)
{
$link .= CHtml::link(CHtml::encode($file[$i]),Yii::app()->baseUrl . '/images/' . $file[$i]) . '<br />';
}
return $link;
}