I had to make my custom pagination helper in CakePHP because the one that cake provides didn't suit my needs. Still, everything was fine about the data retrieval and per-page grouping, but now when I want to generate the links on the bottom of the page (say, < previous
, next >
and the numbering), I can't make the links work as intended.
I found that the problem is the HtmlHelper
escaping the href
portion of the links, so when I generate a link via $this->Html->link()
like:
$this->Html->link('Next >',array('controller' => 'topic','action' => 'list','page:2'));
It outputs:
<a href="http://exam.ple/topic/list/page%3A2">Next ></a>
Putting escape = false
as an option didn't work either.
So is there a way to avoid escaping the url in links in HtmlHelper?
It should be:
$this->Html->link('Next >',
array('controller' => 'topic', 'action' => 'list', 'page' => '2'),
array('escape' => false));
Named params need to be properly added as key value pairs.
This is also in the docs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.