如何在 Velocity 模板中创建面包屑

发布于 2025-01-01 04:35:40 字数 122 浏览 2 评论 0原文

我正在尝试为包含面包屑的横幅创建自定义速度模板,但不知道如何进行。我注意到portal_normal.vm 中#breadcrumb() 的行看起来像Velocity 宏,但我找不到尝试复制它的宏。

有什么想法吗?

I'm trying to create a custom Velocity Template for a banner which includes a breadcrumb but have no idea how to go about it. I've noticed the line which says #breadcrumb() in portal_normal.vm looks like a Velocity macro, but I cannot find the macro to try and replicate this.

Any ideas?

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

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

发布评论

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

评论(2

会发光的星星闪亮亮i 2025-01-08 04:35:40

您可以在门户的源代码中的文件 portal-impl\src\VM_liferay.vm 中找到它。

它定义为:

#macro (breadcrumbs $control_panel)
    #set ($breadcrumb_tag = $theme.getBreadcrumbTag())

    #if ($control_panel == "control_panel")
        $breadcrumb_tag.setShowGuestGroup(false)
        $breadcrumb_tag.setShowParentGroups(false)
    #end

    $breadcrumb_tag.runTag()
#end

You can find it in source code of portal, in file portal-impl\src\VM_liferay.vm.

It is defined as:

#macro (breadcrumbs $control_panel)
    #set ($breadcrumb_tag = $theme.getBreadcrumbTag())

    #if ($control_panel == "control_panel")
        $breadcrumb_tag.setShowGuestGroup(false)
        $breadcrumb_tag.setShowParentGroups(false)
    #end

    $breadcrumb_tag.runTag()
#end
三月梨花 2025-01-08 04:35:40

整个门户的高级布局位于portal_normal.vm 中,至少在6.1 中是这样。 calssic 主题由标题、内容和页脚的 div 标签组成。横幅位于

<div id="heading">
 ...
</div>

块之间。因此,您可能只需将其移动

<nav class="site-breadcrumbs" id="breadcrumbs">
    #breadcrumbs()
</nav>

到该块内的正确位置即可。

您还可以使用命令将速度宏划分为多个文件

#parse("$full_template_path/name_of_custom_velocity_file.vm")

,我刚刚就是这么做的:) 例如。我为页眉、内容和页脚制作了​​自己的文件。

The highlevel layout of the whole portal is in the portal_normal.vm, which atleast in 6.1. calssic theme consists of div tags for heading, content and footer. The banner is between the

<div id="heading">
 ...
</div>

block. So you probably only need to move the

<nav class="site-breadcrumbs" id="breadcrumbs">
    #breadcrumbs()
</nav>

to the right place inside that block.

You could also divide the velocity macros to multiple files with

#parse("$full_template_path/name_of_custom_velocity_file.vm")

commands, which I just did :) Eg. I made own file for header, content and footer.

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