Joh*_*ohn 4 php pagination codeigniter
我需要<a>在CodeIgniter分页中将类名设置为标记.CodeIgniter的$this->pagination->create_links();函数创建如下链接:
<a href="http://example.com/pages/3">3</a>
Run Code Online (Sandbox Code Playgroud)
但是,我需要这样的链接:
<a href="http://example.com/pages/3" class="number">3</a>
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
Bin*_*Das 11
这是使用此代码的下面代码,您可以在Code Ignitor中的分页锚标记内添加类
$config['attributes'] = array('class' => 'myclass');
Run Code Online (Sandbox Code Playgroud)
加
$config['anchor_class'] = 'class="number" ';
Run Code Online (Sandbox Code Playgroud)
之前
$this->pagination->initialize($config);
Run Code Online (Sandbox Code Playgroud)
2.此属性适用于 CI 3.1 以上版本
$config['attributes'] = array('class' => 'myclass');
Run Code Online (Sandbox Code Playgroud)
注意:更多参考:system/libraries/Pagination.php。你会发现以下几行..
// 弃用了对 anchor_class 选项的旧支持
// 应该在 CI 3.1+ 中删除
1.此配置在 (CI 3.1) 版本以下已弃用。
$config['anchor_class'] = 'number';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9845 次 |
| 最近记录: |