Reputation: 5553
I want to use a variable which is used in main.html to all the child template.
For Ex,
I read a property called "ClientID" in main.html. This has to be used in all the inherited html templates instead of reading the same property once again. How to achive this in Play framework
Upvotes: 0
Views: 651
Reputation: 5553
I was able to inject ClientID thro Controllers. But I needed that client ID in all the pages But I shouldn't keep in Session or Cookies. Thats why I wanted to get in main.html and use it in child templates. But I achived this in another way. Defined Play PlugIn, its like an ServletFilter. Overidden 'beforeActionInvocation' and injected the ClientID for all th requests
Upvotes: 0
Reputation: 4427
In Groovy Templates, you have a predefined variable called "_caller" which allows to access the template's caller variables
${_caller.your_var}
Upvotes: 3