java - 无法访问 magnolia cms 中的链接和子页面
问题描述
所以我想从子页面的子页面访问一个链接(孙子?我不知道它的名字对不起)。如图所示
我已经尝试过使用这段代码,但这并没有让我到达我想要的地方。它属于孩子,所以只有一层。
[#assign subNavigationRootPage = navfn.ancestorPageAtLevel(content, 2)!]
[#if subNavigationRootPage??]
[#assign navItems = navfn.navItems(subNavigationRootPage)]
[#list navItems as navItem]
<a class="btn btn-secondary" href="${cmsfn.link(navItem)!}?id=${producto.id}" role="button">Ver detalles</a>
[/#list]
[/#if]
先感谢您
解决方案
据此,_
depth == 1 将根页面返回到此页面,depth == 2 将返回根页面的子页面,依此类推。
所以也许你想要
[#assign subNavigationRootPage = navfn.ancestorPageAtLevel(content, 3)!]
代替
[#assign subNavigationRootPage = navfn.ancestorPageAtLevel(content, 2)!]
我认为无论如何都是令人困惑的。一个节点的“祖先”应该沿着树向上传播,而不是沿着它向下传播。也许它应该是“后裔”。
推荐阅读
- python - Tensorflow:每个测试数据的多标签分类预测都是相同的
- scala - 在scala中应用条件修剪平均值
- python - GAE Cloud Datastore:获取最常编写的模型
- java - org.postgresql.Driver 在 NetBeans 中不起作用
- java - 带连字符的 Java 正则表达式不计入长度
- selenium - 使用 Appium 尝试触摸操作时出错
- r - 使用ggplot2覆盖二元高斯分布的两个轮廓
- php - 能够反序列化一个序列化的字符串
- javascript - 如何在分页页面上阻止 javascript 自动加载?
- python - 如何在 django 中使用 auth_user 模型和自定义模型字段创建自定义注册表单