我有分区模板:
<ul class="container">
<li><a href="#"><span class="w-icons-pagPrev"></span></a></li>
<li><a href="#"><span class="help">1</span></a></li>
<li><a href="#"><span class="help">2</span></a></li>
<li><a href="#"><span class="help">3</span></a></li>
<li><a href="#"><span class="help">4</span></a></li>
<li><a href="#"><span class="help">5</span></a></li>
<li><a href="#"><span class="help">6</span></a></li>
<li><div class="help">...</div></li>
<li><a href="#"><span class="help">41</span></a></li>
<li><a href="#"><span class="help">42</span></a></li>
<li><a href="#"><span class="w-icons-pagNext"></span></a></li>
</ul>
我需要在此范围内添加标记范围和类。我怎么能点这个?在CMenu有两个选择:
但是在CLinkPager中他们不是。
我试过覆盖CLinkPager:
class NewsPager extends CLinkPager
{
protected function createPageButton($label,$page,$class,$hidden,$selected)
{
if($hidden || $selected)
$class.=' '.($hidden ? $this->hiddenPageCssClass : $this->selectedPageCssClass);
return '<li class="'.$class.'">'.CHtml::link("<span class='help'>".$label."</span>",$this->createPageUrl($page)).'</li>';
}
}
It work, but also I need add various class to first and last button. How I can do that?
答案 0 :(得分:1)
试试这种方式
$this->widget('CLinkPager', array(
'currentPage'=>$pages->getCurrentPage(),
'itemCount'=>$item_count,
'pageSize'=>$page_size,
'maxButtonCount'=>6,
'nextPageLabel'=>'<span class="w-icons-pagNext"></span>',
'header'=>'',
));
或者
'pager'=>array(
....
....
'nextPageLabel'=>'<span class="w-icons-pagNext"></span>',
),