在CakePHP 2.2中为分页链接添加类 [英] Add class to pagination links at CakePHP 2.2

查看:203
本文介绍了在CakePHP 2.2中为分页链接添加类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以添加一个类(myclass)到不包含链接的链接(上一个或下一个)。(当前页)我只是添加默认的类之后的类:

I can add a class ("myclass") to the link (previous or next) which does not contain a link.(current page) I just add the class following the default ones:

echo $this->Paginator->prev('< ', array(), null, array('class' => 'prev disabled myClass'));

它会产生这样的效果:

<span class="prev myClass disabled ">prev</span>

但是,当上一个下一个链接有一个链接,然后我的类不添加,它生成如下:

But, when the previous or the next links have a link, then i the class is not added and it generates something like this:

<span class="prev">
    <a href="/tickets/tickets/index/page:1?url=tickets" rel="prev">prev</a>
</span>

如何在这种情况下将一个类添加到此分页链接?

How can i add a class in this cases to this pagination links?

感谢。

推荐答案

API 第二个参数是链接选项的数组,所以我想你可以这样做:

API Says the second parameter is an array for the link options so I guess you could do that:

echo $this->Paginator->prev('< ', array('class' => 'myLinkClass'), null, array('class' => 'prev disabled myClass'));

这篇关于在CakePHP 2.2中为分页链接添加类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆