Modx Revo Wayfinder:向当前菜单的列表项添加额外属性

发布于 2024-12-04 03:06:39 字数 695 浏览 2 评论 0原文

参考: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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野生奥特曼 2024-12-11 03:06:39

执行以下操作:

[[Wayfinder? &hereTpl=`navHere` (INCLUDE OTHER PARAMETERS THAT YOU LIKE)]]

navHere tpl 中编写以下代码:

<li class="current" value="1"><a href="[[+wf.link]]">[[+wf.linktext]]</a></li>[[+wf.wrapper]]

我知道这会起作用。希望得到您的回复。

do the following:

[[Wayfinder? &hereTpl=`navHere` (INCLUDE OTHER PARAMETERS THAT YOU LIKE)]]

In the navHere tpl write the following piece of code:

<li class="current" value="1"><a href="[[+wf.link]]">[[+wf.linktext]]</a></li>[[+wf.wrapper]]

I understand this would work out. Hope to get a response from you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文