skworden, on 14 November 2012 - 05:46 PM, said:
<?php $this->widget('zii.widgets.CListView', array(
..... your other code
'template'=>'{pager}{items}<br/>{pager}',
..... your other code
will do the job
So in your case:
$this->widget('zii.widgets.CListView',array(
'dataProvider'=>$dataProvider,
'viewData'=>array('areaUnit'=>$areaUnit, 'areaType'=>$areaType, 'currencyUnit' => $currencyUnit, 'currencyType' => $currencyType),
'id'=>'postListView',
'template'=>'{pager}{items}<br/>{pager}', 'enablePagination'=>true,
'enableSorting'=>false,
'itemView'=>'searchlist',
));
Note: you can use {summary}, {sorter}, {items} and {pager} here as many times as you like too. Just make sure you always have {items} and one {pager} because it will not use default settings by adding template and it would not show your data.
If you wanted 10 pagers you could. What ever is above (to the left) {items} will show above your list and whatever is below (to the right) will show below. You can also add html like above <br/>.
Pager Template Documentation
<?php
$this->widget('zii.widgets.CListView',
array(
'dataProvider'=>$dataProvider,
'itemView'=>'searchlist',
'id'=>'postListView',
'template'=>'<div class="main-detail-con" style="width:700px;">
<div style="width:700px; padding-left: 0px; text-align:center;" class="listing-center-numbers">
{pager}
</div>
</div><div class="clear"></div>{summary}{items}<br/>{pager}',
'enablePagination'=>true,
'enableSorting'=>false,
)); ?>
Thanks. That worked. My code had if statement for creating a bottom border in the div of the first pager.
Previously I had this code for the first pager
<?php if ($resultCount > 0){ ?>
<div class="main-detail-con" style="width:700px;">
<div style="width:700px; padding-left: 0px; text-align:center;" class="listing-center-numbers">
<?php $this->widget('CLinkPager', array(
'currentPage'=>$pages->getCurrentPage(),
'itemCount'=>$resultCount,
'pageSize'=> 10,
'header'=>'',
)) ?>
</div>
</div><?php } ?>
<div class="clear"></div>
I don't want to output this div if there are no search results <div style="width:700px; padding-left: 0px; text-align:center;" class="listing-center-numbers">. Like the <br /> how can I use php variables in the template ? I tried $hello but it outpts $hello, not the variable's value. I'm thinking of assigning the div and {pager} to a variable and using that variable in template between {summary} {items} .... OR is there another way to do it ?