开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜