如何创建“动态”效果Zend Navigation 中的面包屑
使用 Zend_Navigation,我可以做类似的事情
Home > Projects > Collaborators
,但是如果我想要更有用的东西怎么办?
Home > Project name > Collaborator name
我怎样才能实现这个目标?这是个好主意吗?可能会出现性能问题?因为它必须向上查询层次结构?但无论如何,我怎样才能实现这一目标呢?
With Zend_Navigation, I can do something like
Home > Projects > Collaborators
but What if I want something more useful
Home > Project name > Collaborator name
How can I acheive this? Is it a good idea? Possibly, there would be performance issues? Cos it got to query up the hierarchy? But whatever it is, how can I achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
示例 #34 向您展示了如何使用面包屑的视图部分。我会在
$this->pages
上执行foreach
并在需要的地方进行调整http://framework.zend.com/manual/en/zend.view.helpers.html#zend。 view.helpers.initial.navigation.breadcrumbs
Example #34 shows you how to use a view partial for breadcrumbs. I'd do a
foreach
on$this->pages
and adjust where neededhttp://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.breadcrumbs
最简单的方法是呈现面包屑,然后将协作者名称附加到该字符串。
除非您在导航或站点地图中不需要它,否则这是有效的。否则,您必须手动将其添加到容器。
The easiest way is to render the breadcrumbs and then append to this string the Collaborator name.
This works unless you don't need it in the navigation or sitemap. Otherwise, you have to add it to the container manually.
也许有点晚了,但由于我一直在努力解决这个问题,所以我将其发布,以防它可以帮助任何人。
如果你只是想改变当前页面的实际标签,最简单的方法是这样:
如果你使用 Zend_Routes,findOneByRoute 将会非常有用,如果你不使用 Zend_Routes,你也可以通过 findOneByX 更改它,因为 X 是页面的任何属性。
回答OP的问题,在这种情况下,很容易做到:
$name,合作者的名字。
我希望这对那些仍在使用 ZF1 的人有所帮助。
问候,
Maybe it's a little bit late, but since I've been struggling with this, I'm posting it just in case it can help anyone.
If you just want to change the actual label of the current page, the easiest way to do it is in this way:
The findOneByRoute will work charmly if you use Zend_Routes, if you don't, you can change it by findOneByX, being X is any property of the page.
Answering to the question of the OP, in this case, it would be easy to do:
Being $name, the name of the collaborator.
I hope this helps to those people that still use ZF1.
Greetings,