Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to use theme variables inside layouts? LifeRay 7.2
Hi everyone!
I've been upgrading theme from 7.0 to 7.2.
The problem is layouts. I've upgraded that stuff using this link https://portal.liferay.dev/docs/7-2/tutorials/-/knowledge_base/t/upgrading-7-0-and-7-1-layout-templates-to-7-2
But things like localization don't work inside Layouts.
For example,
At the same time the util above works and I can see the result on the web page, but I can't change order of the portlets or remove them at all.
I think, I might be wrong, but I think that Liferay objects like Locale and functions like languageUtil.get() and so on are not available inside layouts. But why?
Could anybody help me with that please???P.S. Localization works perfect inside templates.
I've been upgrading theme from 7.0 to 7.2.
The problem is layouts. I've upgraded that stuff using this link https://portal.liferay.dev/docs/7-2/tutorials/-/knowledge_base/t/upgrading-7-0-and-7-1-layout-templates-to-7-2
But things like localization don't work inside Layouts.
For example,
${languageUtil.get(locale, 'whats-new-label')}
Console say:
Caused by: freemarker.core._TemplateModelException: Multiple compatible overloaded variations were found with the same priority._The FTL type of the argument values were: Null, string (wrapper: f.t.SimpleScalar)._The Java type of the argument values were: Null, String._The matching overload was searched among these members:_ com.liferay.portal.language.LanguageImpl.get(ResourceBundle, String),_ com.liferay.portal.language.LanguageImpl.get(javax.servlet.http.HttpServletRequest, String, String),_ com.liferay.portal.language.LanguageImpl.get(ResourceBundle, String, String),_ com.liferay.portal.language.LanguageImpl.get(javax.servlet.http.HttpServletRequest, ResourceBundle, String),_ com.liferay.portal.language.LanguageImpl.get(Locale, String),_ com.liferay.portal.language.LanguageImpl.get(javax.servlet.http.HttpServletRequest, ResourceBundle, String, String),_ com.liferay.portal.language.LanguageImpl.get(javax.servlet.http.HttpServletRequest, String),_ com.liferay.portal.language.LanguageImpl.get(Locale, String, String)__----_FTL stack trace ("~" means nesting-related):_ - Failed at: ${languageUtil.get(locale, "whats-new... [in template "null_CUSTOM_valamis-corporate-front-page" at line 18, column 35]_---- [Sanitized]
at freemarker.ext.beans.OverloadedMethods.getMemberAndArguments(OverloadedMethods.java:102)
at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:60)
at freemarker.core.MethodCall._eval(MethodCall.java:62)
at freemarker.core.Expression.eval(Expression.java:78)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82)
at freemarker.core.DollarVariable.accept(DollarVariable.java:41)
at freemarker.core.Environment.visit(Environment.java:324)
[at freemarker.core.MixedContent.accept(MixedContent.java:54)
at freemarker.core.Environment.visit(Environment.java:324)
at freemarker.core.Environment.process(Environment.java:302)
at freemarker.template.Template.process(Template.java:325)
at com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate.processTemplate(FreeMarkerTemplate.java:137)
at com.liferay.portal.template.BaseTemplate.processTemplate(BaseTemplate.java:127)
... 79 more
At the same time the util above works and I can see the result on the web page, but I can't change order of the portlets or remove them at all.
I think, I might be wrong, but I think that Liferay objects like Locale and functions like languageUtil.get() and so on are not available inside layouts. But why?
Could anybody help me with that please???P.S. Localization works perfect inside templates.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™