From a master html template I’m calling #{doLayout} which renders my view html. I’d like to call a custom html template as well such as #{happyHeader} which I’d like to define inside my view html file. Something like this:
<html>
<body>
#{happyHeader}
<hr/>
#{doLayout}
</body>
</html>
And in my index.html have something like this:
<p>My happy doLayout main content here</p>
#{define happyHeader}
<h1>Nice header</h1>
#{/}
I’ve looked around StackOverflow and couldn’t find a similar question, and neither do the custom template solutions in the Play Framework docs seem to cover this.
You do this with
#{set}and#{get}.You set the value in your
index.htmllike this:And you get it in your
main.htmllike this: