将模板从velocity迁移到freemarker

发布于 2025-01-17 08:47:43 字数 2222 浏览 3 评论 0原文

我需要将一些模板从liferay 6.2中的velocity迁移到liferay 7.4 dxp的freemarker,我尝试使用USCavalry工具,但结果不完整,有人可以帮助我吗? 这是我使用我提到的工具获得的结果的示例,当我尝试测试模板时,我遇到了几个错误。

<#assign layoutId = request.get("theme-display").get("plid")>
<#-- get the service for layout-->
<#assign layoutService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService")>
<#--convert the layout id into long-->
<#assign layoutLong = getterUtil.getLong(layoutId)>
<#--take a layout object-->
<#assign layout = layoutService.getLayout(layoutLong)><#assign pageName = layout.getName(locale)>
<#if layout.getExpandoBridge().getAttribute("isTabPage") == false>    
        <h1 id="genericPageTitle">
                <span class="webContentPageTitle">${pageName}</span>
        </h1>
</#if>
<#-- get Date object-->
<#assign modDate = dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", reserved-article-modified-date.data, locale)>
<#-- get format Date-->
<#assign modDateFormat = dateTool.format("yyyy/MM/dd", modDate, locale)><#assign paramName = "error">
<#assign errorToShow = httpUtil.getParameter(request.get("attributes").CURRENT_COMPLETE_URL, paramName)>
<div class="webContentModifiedDate <#if layout.getExpandoBridge().getAttribute('isTabPage') == true> webContentModifiedDateTapPage </#if>">
        <div class="webContentPrint" onclick="printElem('webContentMainDiv');"></div> 
</div>
<div id="webContentMainDiv" class="webContentMainDiv">

        <div class="portlet-msg-error">
        ${languageUtil.get(locale, errorKey.getData())}<br/>
                <#if errorToShow != "">
                        <div id="portlet-msg-error-detail" style="margin-top:30px;">
                                ${languageUtil.get(locale, "error.details")}<br/>
                                <b>
                                        <i>${httpUtil.decodeURL(errorToShow)}<i>
                                </b>
                        </div>
                </#if>
        </div>
</div>```

I need to migrate some templates from velocity in liferay 6.2 to freemarker for liferay 7.4 dxp, I tried to use the USCavalry tool, but the result is not complete, can someone help me?
this is an example of the results I get with the tool I mentioned, when I try to test a template I get several errors.

<#assign layoutId = request.get("theme-display").get("plid")>
<#-- get the service for layout-->
<#assign layoutService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService")>
<#--convert the layout id into long-->
<#assign layoutLong = getterUtil.getLong(layoutId)>
<#--take a layout object-->
<#assign layout = layoutService.getLayout(layoutLong)><#assign pageName = layout.getName(locale)>
<#if layout.getExpandoBridge().getAttribute("isTabPage") == false>    
        <h1 id="genericPageTitle">
                <span class="webContentPageTitle">${pageName}</span>
        </h1>
</#if>
<#-- get Date object-->
<#assign modDate = dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", reserved-article-modified-date.data, locale)>
<#-- get format Date-->
<#assign modDateFormat = dateTool.format("yyyy/MM/dd", modDate, locale)><#assign paramName = "error">
<#assign errorToShow = httpUtil.getParameter(request.get("attributes").CURRENT_COMPLETE_URL, paramName)>
<div class="webContentModifiedDate <#if layout.getExpandoBridge().getAttribute('isTabPage') == true> webContentModifiedDateTapPage </#if>">
        <div class="webContentPrint" onclick="printElem('webContentMainDiv');"></div> 
</div>
<div id="webContentMainDiv" class="webContentMainDiv">

        <div class="portlet-msg-error">
        ${languageUtil.get(locale, errorKey.getData())}<br/>
                <#if errorToShow != "">
                        <div id="portlet-msg-error-detail" style="margin-top:30px;">
                                ${languageUtil.get(locale, "error.details")}<br/>
                                <b>
                                        <i>${httpUtil.decodeURL(errorToShow)}<i>
                                </b>
                        </div>
                </#if>
        </div>
</div>```

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

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

发布评论

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

评论(1

葵雨 2025-01-24 08:47:43

USCAVALRY是古老的。对不起,您必须手工完成大部分工作。

USCavalry is ancient. You have to do most of the work by hand, sorry.

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