Zend 导航菜单标签中的换行符
我需要创建一个
>使用 Zend_navigation 生成的菜单项的显示标签中的标记,但似乎无法找到这样做的方法。
我的导航项在 XML 配置中定义为:
<registermachine>
<label>Register your Slitter Rewinder</label>
<controller>service</controller>
<action>register</action>
<route>default</route>
</registermachine>
我想在“your”和“slitter”之间的输出 HTML 中强制使用
标记,以便它显示在两行中,如下所示:
注册您的 分切复卷机
但是,我似乎做不到。显然,在 XML 中使用
会中断解析,并且使用 html 实体意味着标签显示为:
注册您的
Slitter Rewinder
有没有人有这方面的经验可以提供建议?
提前致谢!
I have a need to create a <br/> tag in the display label for a menu item generated using Zend_navigation, but don't seem to be able to find a way to do so.
My navigation item is defined in the XML config as:
<registermachine>
<label>Register your Slitter Rewinder</label>
<controller>service</controller>
<action>register</action>
<route>default</route>
</registermachine>
I want to force a
tag in the output HTML between 'your' and 'slitter', such that it appears on two line as below:
Register your
Slitter Rewinder
However, I can't seem to do it. obviously using
in the XML breaks parsing, and using html entities means that the lable is displayed as:
Register your <br/>Slitter Rewinder
Has anyone had experience of this that can offer advice?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没有这样的内置选项,您必须使用部分
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.menu
您也可以尝试使用
there is no such option built-in you have to use a partial
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.menu
you may also try a hack with
<label><![CDATA[Menu label<br/>Second line]]></label>
我找到了一个(hacky)解决方案:
我更新了 navigation.xml 以在需要
标记的地方使用{br}
标记,然后修改基本Zend/View/Helper/Navigation/Menu.php
文件如下:在
htmlify
函数中,更改为
I can (and likely will) override the Zend Library Menu View Helper在某些时候与我自己的,但是这个至少现在覆盖它。
I found a (hacky) solution:
I updated my navigation.xml to use
{br}
tokens wherever a<br/>
tag is required, and then amended the baseZend/View/Helper/Navigation/Menu.php
file as follows:within
htmlify
function, changedto
I could (and probably will) override the Zend Library Menu View Helper with my own at some point, but this at least cover it for now.
有一个 escapeLabels 布尔值用于转换 html 标签,默认情况下为 true。
您可以像这样设置导航
http: //framework.zend.com/apidoc/2.0/classes/Zend.View.Helper.Navigation.Menu.html#escapeLabels
there is a escapeLabels boolean used to convert html tags and it's true by default.
You can set your navigation like this
http://framework.zend.com/apidoc/2.0/classes/Zend.View.Helper.Navigation.Menu.html#escapeLabels