Modx Revo Wayfinder:向当前菜单的列表项添加额外属性
参考:Modx Revo 上的 Wayfinder
我一直在广泛搜索,但找不到答案。
我发现一个非常棘手的情况,试图使用包装当前菜单的列表项(您当前所在页面的菜单链接)输出额外的属性。 例如: 而不仅仅是这一行..
<li class="current"><a href="#">This is the menu</a></li>
我想要..
<li class="current" value="1"><a href="#">This is the menu</a></li>
参见 value="1"
我尝试创建一个与 &hereTpl 参数相关的块,但显然这个参数在 Wayfinder Revo 中不再有效(或者是吗?)。
我认为另一种可能的路线是,是否有一种方法可以让 &rowTpl 内的条件仅呈现当前菜单所需的属性,但又呈现另一堵砖墙。
我还尝试了 [[+wf.attributes]] (在模板块中的列表项标记上,并将所需的属性放入所有资源/文档的链接属性中,假设它仅在资源/文档被渲染时才会呈现) “当前”,但该属性只是输出到所有菜单项,
您能分享一下想法吗?非常感谢您的帮助。
Ref: Wayfinder on Modx Revo
I've been searching extensively and couldn't find the answer.
I find a very tricky situation trying to output an extra attribute with the list item that wraps the current menu (the menu link on of the page you're currently in).
For example:
Instead of just this line..
<li class="current"><a href="#">This is the menu</a></li>
I want..
<li class="current" value="1"><a href="#">This is the menu</a></li>
see value="1"
I tried creating a chunk in relation with the &hereTpl parameter but apparently this parameter is no longer valid in Wayfinder Revo (or is it?).
I think another possible route is if there's a way for a conditional inside the &rowTpl to render the needed attribute only for the current menu but again another brick wall.
I also tried the [[+wf.attributes]] (on the list item tag in the template chunk and put the needed attribute in the Link attributes of all the the resources/documents assuming it's going to render only when the resource/document is "current" but then the attribute is just outputted to all the menu items.
Could you share a thought? thanks so much for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
执行以下操作:
在 navHere tpl 中编写以下代码:
我知道这会起作用。希望得到您的回复。
do the following:
In the navHere tpl write the following piece of code:
I understand this would work out. Hope to get a response from you.