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
RE: How to access the theme init_custom.ftl variables from a Fragment
As I understood, you can use the theme `init_custom.ftl` file to override `init.ftl` or to create new variables to be used in the theme. I've also noticed that if you add this line of code inside your Fragment, you'll have access to your theme `init.ftl` variables, but not to your `init_custom.ftl` ones
[#include init/]
Is there a way to access `init_custom.ftl` variables inside a Fragment in Liferay 7.3?
Check your build directory in the theme, as I understand (I may be
wrong) the init_custom gets imported to the init file.
Does this work?
[#include init_custom/]
Hello Marcos, I know it's a bit late but you can do so by including this in your fragment:
[#include fullTemplatesPath + "/path/to/file/template.ftl" /]
By using this line of code, you can not only use variables but also macros on that template you just included
Powered by Liferay™