As of now, Liferay provides a set of global variables as defined in init.vm
that can be used by theme templates. These variables are set in init.vm
and is located inside Liferay ROOT.war : $PATH_TO_WEBAPPS/ROOT/html/themes/_unstyled/templates
.
And Inside my custom theme portal_normal.vm
, I could use it by simply adding #parse ($init)
. Which works great.
Now moving into my problem. I am using velocity template for sending my email address.So, Inside my portlet i have created an email template in the location as $SOME_PORTLET_NAME/src/main/webapps/template/email.vm
.
I could send the custom variables to the template using,
VelocityContext velocityContext = new VelocityContext();
velocityContext.put("vp", velocityParameters);
But I couldn't use the default variables provided by the Liferay as used in theme.
I am trying to use $languageUtil.get
for internationalization in my email template.
What have i tried?
- Cloning
init.vm
inside the template and importing it. Which didn't worked; stupid me. - Provide full path to the
ROOT.war
location ofinit.vm
. It didn't worked either.(I am surprised it should have worked.)
Question :
Is there a way to use those velocity global variables in custom portlets(i.e outside theme)?
Could this be achievable using Java?
Or is it better to perform LanguageUtil.get and send the value only to template(This would be my last option)?
Thanks!!