在面包屑中传递参数
我还是 Zend Framework 的新手,所以如果这是一个愚蠢的问题,请原谅我!
我在应用程序的主布局中使用面包屑视图助手来提供常用的面包屑功能。但是,我确实需要面包屑来包含传递给用户单击的操作的参数...
因此,如果您从“/controller/parent/id/1”单击到“/controller/child/id/2”,子页面上的面包屑应该链接回“/controller/parent/id/1”,而不仅仅是“/controller/parent/”
我的选择是什么?我是否需要使用数据库的全部内容构建 Zend_Navigation 树,以便满足每个操作的每个可能的 ID?或者我可以编写自己的帮助程序,以便在渲染面包屑时向 Zend_Navigation_Page 对象添加额外的参数吗?
第一个选项似乎是阻力最小的路径,但感觉效率很低!不过,我认为这可以通过延迟加载来完成,以减少内存使用。
感谢您的帮助!
汤姆
I'm still a relative newcomer to Zend Framework, so please forgive me if this is a stupid question!
I'm using the breadcrumbs view helper in my application's main layout to provide the usual breadcrumb functionality. However I really need the breadcrumbs to contain the parameters passed to the actions that user has clicked on...
So if you click through from "/controller/parent/id/1" to "/controller/child/id/2" the breadcrumb on the child page should link back to "/controller/parent/id/1" rather than just "/controller/parent/"
What are my options? Do I need to build my Zend_Navigation tree with the entire contents of my database, so that every possible ID for every action is catered for? Or can I write my own helper to add the extra parameters to the Zend_Navigation_Page object when the breadcrumbs are rendered?
The first option seems to be the path of least resistance, but feels very inefficient! Although, I suppose this could be done with lazy loading to cut down on memory usage.
Thanks for any help!
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为答案是在 navigation.xml 中使用 reset_params 在
页面中,您需要像这样设置 reset_params = 0:
请参阅:http://framework.zend.com/manual/en/zend.navigation.pages.html
例如,在我们的应用程序中,我们使用如下内容:
I think the answer is to use the reset_params inside your navigation.xml
Inside your page you need to set reset_params = 0 like this:
See: http://framework.zend.com/manual/en/zend.navigation.pages.html
For example on our application we use something like this: