如何在 CakePHP 中对多个结果进行分页?
如何使用 cakePHP 中的分页助手在同一页面上显示多个结果集?他们会独立寻呼。
编辑:
我发现它不能这样做的一个原因是因为分页助手将从控制器/操作获取其 URL,然后在末尾附加其参数。 如果它从地址栏中提取 url,拥有自己的唯一变量,然后执行 str_replace 来获取下一个要导航的位置(如果您已经分页),或者如果它不存在则追加它。 现在,我正在考虑重写分页助手来支持此功能,但我不确定我是否需要这样做,或者他们是否已经支持此功能,而我做错了
How can I use the paginatation helper in cakePHP to show more than one result set on the same page? They would page independently.
EDIT:
I found out one reason why it can't do that is because the pagination helper would get its URL from the controller/action and then appends its parameters at the end.
If it pulled the url from the address bar, had its own unique variable and then did an str_replace to get the next one to navigate to if you've already paged, or append it if it doesn't exist.
Right now, I'm thinking of rewriting the pagination helper to support this feature, but I'm not sure if I would need to or if they already support this and I'm doing it wrong
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我的解决方案。在您的控制器中:
在您的视图中:
要点是将您的模型名称输入到控制器的分页方法和分页器的链接方法(排序、上一个、下一个)中。
Here is my solution. In your controller :
In your view :
The point is input your model name to Controller's paginate method and to Paginator's link method (sort, prev, next).