Zend_Paginator 与查询参数链接
您能否告诉我如何与 Zend_Paginator 建立链接,如下所示: http://url/controller/action?id=47&page=2 。 我想向 url 查询添加 url 附加参数,例如 url?id=value,而不是像这样的参数: url/控制器/操作/参数/值。您还可以告诉我如何将视图变量传递给页面之外的部分吗? 谢谢。
Could you please tell me how to make link with Zend_Paginator like this:
http://url/controller/action?id=47&page=2.
I want to add to url additional paramter to the query of url like url?id=value, not paramater like this one:
url/controller/action/param/value. Could you also tell please how to pass a variable for view to partial aside from page.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个默认的视图助手 URL 是为了处理这个问题而创建的。
您可以使用以下内容生成您的网址:
如果您省略一些参数,则帮助程序将重用查询网址中的那些参数
因此,使用 Zend_Paginator 您可以这样:
** 编辑 **
反映我的第一条评论的示例
There is the default view helper Url that is made for handling that.
you can generate your url with the following :
If you omit some of the params, the helper will reuse those that were in the query url
So, with Zend_Paginator you go this way :
** EDIT **
Exemple to reflect my first comment
所以,如果我正确理解这篇文章...这是您的解决方案,用于使 $_GET 或 $_POST 值在分页器的结果集中为每个后续页面加载持久存在?我有一个返回结果的搜索函数,但是当我尝试对结果进行分页时,后续页面加载会取消设置 $_POST 变量,并且我开始返回所有结果,因为通配符搜索变为
SELECT * FROM table WHERE col LIKE ' %%'
。不是我想要的编辑:我将关键字加载到 zend_cache() 中,并通过 URI 传递缓存的 id(关键字的 md5() 值)在页面加载时将它们回调出来。如果有人感兴趣我会发布代码
so if i understand this post(s) correctly ... this is your solution for making a $_GET or $_POST value persistent for each subsequent page load within a Paginator'ed set of results? i have a search function that's returning results but when i try to paginate through the results the subsequent page loads unsets that $_POST variable and i start returning all of the results because the wildcard search becomes
SELECT * FROM table WHERE col LIKE '%%'
. not what i wantEDIT: i am loading the keywords into zend_cache() and calling them back out on page load by passing the id of the cache ( the md5() value of the keyword ) by way of the URI. if anyone's interested i'll post the code