Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 6.0.5 GA, 6.0.6 GA, 6.0.11 EE
-
Fix Version/s: --Sprint - SP, 6.0.12 EE, 6.1.0 CE RC1
-
Component/s: Theme Dev
-
Labels:
-
Branch Version/s:6.0.x
-
Backported to Branch:Committed
-
Liferay Contributor's Agreement:Accept
-
Similar Issues:
Description
FTL_liferay.ftl file has an incorrect if-clause for the main css file. Also when the code is manually fixed it seems that css_main_file and js_main_file are undefined. What this means is that all popups have same background than your website and nothing else. No textboxes, buttons, nothing. This is because processing the portal_pop_up.ftl stops when these errors occur. Here's the part where these macros are called in portal_pop_up.ftl:
<head>
<title>$
</title>
$
{theme.include(top_head_include)} <@liferay.css file_name=css_main_file/>
<@liferay.js file_name=js_main_file/>
</head>
Here's the broken code snippet from FTL_liferay.ftl:
<#macro css file_name>
<#assign file_id = "">
<#if file_name = css_main_file>
<#assign file_id = "mainLiferayThemeCSS" />
</#if>
<link class="lfr-css-file" href="$
{file_name}" id="${file_id}" rel="stylesheet" type="text/css" /></#macro>
<#macro js file_name>
<#assign file_id = "" />
<#if file_name == js_main_file>
<#assign file_id = "mainLiferayThemeJavaScript" />
</#if>
<script id="${file_id}" src="${file_name}
" type="text/javascript"></script>
</#macro>
As you can see the <#if file_name = css_main_file> is missing a =-mark. Even after fixing the missing =-mark, both variables still caused errors saying they were undefined. I managed to fix the undefined error by copy-pasting both functions to my init_custom.ftl, renaming them and using them from there:
<#macro css file_name>
<#assign file_id = "">
<#if file_name == css_main_file>
<#assign file_id = "mainLiferayThemeCSS" />
</#if>
<link class="lfr-css-file" href="$
{file_name}" id="${file_id}" rel="stylesheet" type="text/css" /></#macro>
<#macro js file_name>
<#assign file_id = "" />
<#if file_name == js_main_file>
<#assign file_id = "mainLiferayThemeJavaScript" />
</#if>
<script id="${file_id}" src="${file_name}
" type="text/javascript"></script>
</#macro>
Errors are:
19:45:07,296 ERROR [runtime:96] Expression css_main_file is undefined on line 6, column 26 in FTL_liferay.ftl.
20:01:43,588 ERROR [runtime:96] Expression js_main_file is undefined on line 16, column 27 in FTL_liferay.ftl.
I've attached a stacktrace from both errors. I don't know why those variables are undefined, but maybe you'll find it as I don't know the whole process of Liferay Freemarker processing.

Stacktraces for the errors