Can you recursively extend templates in Play Framework?
In Play Framework, Can one use the #{extends}
tag recursively?
I.e., in a child template, extend a parent template, and in the parent template, extend yet another template, like so:
child.html:
#{extends 'parent.html' /}
<h1>I'm a child</h1>
parent.html:
#{extends 'grandparent.html' /}
<h1>I'm a parent</h1>
<div id="content">#{doLayout /}</div>
grandparent.html:
<h1>I'm a grandparent</h1>
<div id="more-content">#{doLayout /}</div>
(Documen开发者_如何学Ctation on the extends
tag:
http://www.playframework.org/documentation/1.2.2/templates#inheritance )
Yes, you can. No problem's at all. It's even a good rpactice to reuse code in different sections of your application.
精彩评论