Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Playframework nested templates - argument passing

Can you pass specific, limited number of arguments to a included,nested template ?

For example, in ParentTemplate.html, to do something like this (consider this as pseudocode :) :

#{include 'path/to/ChildTemplate.html' arg1: someArgInParentTemplate, arg2: someArgInParentTemplate2 /}

So that we can access only 2 separated variables for handling in child template named arg1 and arg2.

I personally don't like that all parent template variables are accessible in child template. Also, variable names in parent and in included child templates must be same - that's not good for templates modularity imo, or am I missing something here?

Simple and productive FW though :)

like image 263
matko.kvesic Avatar asked Nov 28 '25 01:11

matko.kvesic


1 Answers

instead of using an include, create a tag (see this) and you will be able to limit the parameters it can access.

like image 155
Pere Villega Avatar answered Nov 30 '25 15:11

Pere Villega