如何将 hst:sitemenu 链接到 ftl?

发布于 2025-01-14 19:45:08 字数 68 浏览 3 评论 0原文

我正在尝试将菜单链接到他的通讯员 ftl,但我不明白我必须采取哪些正确步骤。我没有找到任何关于它的有用文档。欢迎所有帮助。

I am trying to link a menu to his correspondent ftl and I don´t understand which are the proper steps I have to take. I didn´t found any usefull documentation about it. All the help is welcomed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

鹤仙姿 2025-01-21 19:45:08

基本上,您需要检索组件中的菜单并将其放在请求中。然后您可以在ftl 中引用菜单。您可以使用 essentials 菜单组件动态菜单组件。或者您有一个自定义组件。我建议启动一个原型项目并安装必需品中的简单内容。这应该添加一个菜单,您可以查看该菜单以了解其工作原理。

示例 来自我们的在线教程 看起来像 这:

<#include "../include/imports.ftl">
<#if menu??>
  <div class="hst-container">
    <div class="hst-container-item">
      <#if menu.siteMenuItems??>
        <#list menu.siteMenuItems as item>
          <#if item.selected || item.expanded>
            <div class="list-group left-nav">
              <a href="<@hst.link link=item.hstLink/>" class="list-group-item level1">${item.name?html}</a>
                <#list item.childMenuItems as item>
                  <a href="<@hst.link link=item.hstLink/>" class="list-group-item level2"><i class="fa fa-angle-right"> </i>${item.name?html}</a>
                </#list>
            </div>
          </#if>
        </#list>
      </#if>
    </div>
  </div>
</#if>

Basically, you need to retrieve the menu in a component and put that on the request. In the ftl you can then reference the menu. You can use the essentials menu component or the dynamic menu component. Or you have a custom component. I'd suggest starting an archetype project and installing the simple content from essentials. This should add a menu that you can look at to see how it works.

An example from one of our online tutorials looks like this:

<#include "../include/imports.ftl">
<#if menu??>
  <div class="hst-container">
    <div class="hst-container-item">
      <#if menu.siteMenuItems??>
        <#list menu.siteMenuItems as item>
          <#if item.selected || item.expanded>
            <div class="list-group left-nav">
              <a href="<@hst.link link=item.hstLink/>" class="list-group-item level1">${item.name?html}</a>
                <#list item.childMenuItems as item>
                  <a href="<@hst.link link=item.hstLink/>" class="list-group-item level2"><i class="fa fa-angle-right"> </i>${item.name?html}</a>
                </#list>
            </div>
          </#if>
        </#list>
      </#if>
    </div>
  </div>
</#if>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文