RE: How to access the theme init_custom.ftl variables from a Fragment

Jamie Sammons, modified 3 Years ago. New Member Posts: 2 Join Date: 7/17/21 Recent Posts

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?

Lee Jordan, modified 3 Years ago. Expert Posts: 449 Join Date: 5/26/15 Recent Posts

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/]
Jamie Sammons, modified 1 Year ago. New Member Post: 1 Join Date: 2/15/24 Recent Posts

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