Reputation: 4245
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.
Upvotes: 2
Views: 339
Reputation: 11274
You do this with #{set}
and #{get}
.
You set the value in your index.html
like this:
#{set 'happyHeader'}
<h1>Nice header</h1>
#{/set}
And you get it in your main.html
like this:
#{get 'happyHeader' /}
Upvotes: 4