Silverstripe 中的一些菜单自定义
1)我需要根据菜单行为每个菜单项设置不同的类名(迭代,我只需要一个数字)
<% control Menu(1) %>
<div class="mainmenu-item-$MenuItemRow"><a href="$Link">$MenuTitle</a></div>
<% end_control %>
2)有没有一种简单的方法来创建一个小的第二个菜单?
1) i need set different class name for every menu item, based on a menu row (iterating, i need just a number)
<% control Menu(1) %>
<div class="mainmenu-item-$MenuItemRow"><a href="$Link">$MenuTitle</a></div>
<% end_control %>
2) is there a simple way to create an small second menu ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://doc.silverstripe.org/built-in-page-controls# dataobjectset_options
问题 2:
如果它只显示导航的另一个级别,您可以使用例如。
<%控制菜单(2)%>
。也许这个帖子可以帮助您了解如何仅显示特殊项目: http://silverstripe.org/archive/显示/197044。还请考虑一下您的页面树中可能有用于子导航的菜单项的可能性,这些菜单项仅重定向到层次结构中其他位置的项目!所以你可以例如。在页面树中创建一个单独的“页脚”分支并使用:
http://doc.silverstripe.org/built-in-page-controls#dataobjectset_options
Question 2:
if it should just show another level of your navigation you can use eg.
<% control Menu(2) %>
. And maybe this thread helps you about how to display only special items: http://silverstripe.org/archive/show/197044.Think also of the possibility that you could have menu items in your page tree for you sub-navigation that are only redirects to items somewhere else in the hierarchy! So you could eg. create a seperate "Footer" branch in your page tree and use: