html - 如何在 ClinkPaget yii 中的 <a></a> 之间添加标签 <span>

标签 html yii pagination

我有分页模板:

<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. 链接标签包装器
  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?

最佳答案

这样试试

$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>',
),

关于html - 如何在 ClinkPaget yii 中的 <a></a> 之间添加标签 <span>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32402426/

相关文章:

facebook - 在 Hybridauth 中为 Yii 框架配置 Facebook

PHP 分页不起作用

html - 如何在 3D 翻转的 div 中的图像旁边添加文本

json - Yii2 RESTful Web服务: JSON Request Format

php - 更好的 MongoDB 文档对象映射器设计模式

php - 如何在单独的页面上显示每个(只有一个)搜索结果 mysql php

node.js - 使用 KnexJS + PG 创建分页

jquery - 使用 Jquery 基于页面上光标位置的屏幕掩码

javascript - 在调整网页大小之前,嵌入的谷歌地图显示错误

html - 为什么 div#navbar 和 div #navbar 有不同的结果?