Hi,
I am new to Yii, and that is my first post , i want to arrange the images so that every 3 images will be shown in the same row, and i have
encountered a strange result, the images will be arranged as below diagram.
X X X
X
X X
X X X
X X X
X X X
blank cell will be shown instead of the image.
here is my index view
<div style="width: 900px;">
<?php $this->widget(‘zii.widgets.CListView’, array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
'enablePagination' => true,
'pager' => array('pageSize' => '20','cssFile'=> Yii::app()->baseUrl.'/protected/css/yiipager.css',),
'cssFile'=> Yii::app()->baseUrl.'/protected/css/yiipager.css',
'summaryText'=>'{page} of {pages}',
)); ?>
</div>
and here is my _view
<div class="div_container">
<a href=’<?=$data->href?>’ title=’<?=$data->title?>’>
<div class="div_image">
<img class="lazyimg" src="<?=$data->imgSrc?>" title="<?=$data->title?>" data-original="<?=$data->imgSrc?>" >
</div>
<div class=‘div_details’>
<div class=‘title’><b><?=$data->title?></b></div>
<div class=‘description’><?=$data->remark?></div>
</div>
</a>
<div></div>
here is my controller code
/*
lazyloading.min.js is the utility (javascript file) downloaded
lazy.js is the javascript only has few
*/
public function actionIndex()
{
$criteria = new CDbCriteria();
$baseUrl = Yii::app()->baseUrl;
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($baseUrl.'protected/js/lazyloading.min.js');
$cs->registerScriptFile($baseUrl.'protected/js/lazy.js');
$cs->registerScriptFile($baseUrl.'protected/css/yiipager.css');
$criteria = new CDbCriteria();
$criteria->join ="inner join rog_category on rog_category.id=`t`.categoryId";
$criteria->condition="rog_category.category='car' and complete=false";
$dataProvider=new CActiveDataProvider('Car', array('criteria' => $criteria,));
$dataProvider->pagination->pageSize=15;
$this->render('index',array(
'dataProvider'=>$dataProvider,
'criteria'=>$criteria,
'pagination' => array(
'pageSize' => 15,
),
));
}
here is the yiipager.css
div.div_container{width: 300px; float: left;}
.lazyimg{width=100px;height=280px;}
ul.yiiPager{font-size:20px;border:0;margin:0;padding:0;line-height:100%;list-style-type: none;}
Please help.
I have also encounter another problem about UrlManager, and I will start a new post about that.
Thx your help.