我正在尝试让 CakePHP 的分页助手与 bootstrap 很好地配合。也就是说,我希望我的分页元素看起来像 bootstrap 的,但由 CakePHP 生成。
目前我的视图页面上有这个:
<?php
echo $this->Paginator->numbers(array(
'before' => '<div class="pagination"><ul>',
'separator' => '',
'currentClass' => 'active',
'tag' => 'li',
'after' => '</ul></div>'
));
?>
它产生以下标记:
<div class="pagination">
<ul>
<li class="active">1</li>
<li><a href="/test/posts/page:2">2</a></li>
<li><a href="/test/posts/page:3">3</a></li>
</ul>
</div>
问题是,因为活动页面(本例中为 1)没有<a>
中的元素<li>
标签,它在页面上无法正确显示(请参阅此处:https://i.stack.imgur.com/VKRlW.png https://i.stack.imgur.com/VKRlW.png).
我似乎在食谱上找不到任何提到可以解决这个问题的内容。
这可以解决吗?
我使用了启动所需的 cake php html 的通用函数。
要点代码:https://gist.github.com/jruzafa/5302941 https://gist.github.com/jruzafa/5302941
<div class="pagination pagination-large">
<ul class="pagination">
<?php
echo $this->Paginator->prev(__('prev'), array('tag' => 'li'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
echo $this->Paginator->numbers(array('separator' => '','currentTag' => 'a', 'currentClass' => 'active','tag' => 'li','first' => 1));
echo $this->Paginator->next(__('next'), array('tag' => 'li','currentClass' => 'disabled'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
?>
</ul>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)