Hi friends,
I have one bug in here CListView displays random images in here but i want 2nd row image instead of 2 nd column thanks in advance. i don’t know fluent English sorry for that.
Hi friends,
I have one bug in here CListView displays random images in here but i want 2nd row image instead of 2 nd column thanks in advance. i don’t know fluent English sorry for that.
It looks like a problem with the _view.php file.
Thanks for your reply…ya friend. but how could cleared out this…
this is my _view file
<?php
echo '<h4>'. CHtml::link(CHtml::encode($data->project_title), array('portfolioview', 'id'=>$data->id, 'title'=>$data->project_title), array('title'=>$data->project_title)).'</h4>';
echo CHtml::link(CHtml::image(Yii::app()->baseUrl."/images/".$data->upload_image, "No image", array("width"=>100, "height"=>100)), array('portfolioview', 'id'=>$data->id, 'title'=>$data->project_title));?>
and my index file is…
<?php
$data = $dataProvider->getData();
?>
<table width="200" border="1">
<?php foreach($data as $profile):?>
<tr>
<td><img src="<?php echo Yii::app()->baseUrl."/images/".$profile['upload_image']; ?>" width="100" height="100"/></td>
<td><img src="<?php echo Yii::app()->baseUrl."/images/".$profile['upload_image']; ?>" width="100" height="100"/></td>
<td><img src="<?php echo Yii::app()->baseUrl."/images/".$profile['upload_image']; ?>" width="100" height="100"/></td>
</tr>
<?php endforeach; ?>
</table>
OK since your are not using a CListView as indicated, your problem is in the index.php code above. You are displaying the same image 3 times before moving to the next image. this is not exactlly right but an idea:
<table width="200" border="1">
<tr>
<?php foreach($data as $profile):?>
<td><img src="<?php echo Yii::app()->baseUrl."/images/".$profile['upload_image']; ?>" width="100" height="100"/></td>
<?php if($rowNumber % 3 == 0): ?>
</tr>
<tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
$rowNumber needs to keep track of what row you are on. I’ll leave it up to you to implement.