ANIKET MAITRA
ANIKET MAITRA

Reputation: 1

Is it possible to include a template which is not the same directory as the current one in Freemarker?

My current working template is x/xx/xxx/xxxx/template.ftl I want to include a template which is present in the x/ directory. Is it possible ?

I tried using [#include '../../../template_name.ftl'] but that didn't work.Can someone suggest me a way out?

Upvotes: 0

Views: 196

Answers (1)

ddekany
ddekany

Reputation: 31132

Yes, it's possible with ..-s. Not sure what "didn't work" means, what the error message was. But generally the problem is that the directory you step back into is outside the template root directory. That's the directory of all the templates that was specified in the FreeMarker configuration. For security reasons, it's not allowed to back out from that directory with ..-s.

Upvotes: 1

Related Questions