'migrate template from velocity to freemarker
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>```
Solution 1:[1]
USCavalry is ancient. You have to do most of the work by hand, sorry.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ddekany |