Add class to pagination links at CakePHP 2.2

2019-09-07 06:04发布

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'));

And it generates something like this:

<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?

Thanks.

1条回答
Anthone
2楼-- · 2019-09-07 06:25

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'));
查看更多
登录 后发表回答