2015-09-04 66 views
2

之间添加标签我pagionation的模板:如何在ClinkPaget警予

<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的两个选项:

  1. linkLabelWrapper
  2. linkLabelWrapperHtmlOptions

但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

要他?点这个?他们呢?请用正确的拼写重新编辑您的代码,以便我们能够理解。 –

+0

我很匆忙) – YuriiChmil

回答

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>', 
), 
+0

很多谢谢!什么至于

  • ...
  • ?如何添加? – YuriiChmil

    +0

    你已经尝试过''nextPageLabel'=>'

    ...
    ','?发生了什么 ? – scaisEdge

    +0

    哦,我解释错了。我需要这样的想法[链接](http://joxi.ru/BA0pgD8hEdzzAy) – YuriiChmil