我還沒有在Ruby框架中找到類似於Ruby on Rails部分視圖的部分視圖的概念。例如,如果有layouts/main.scala.html
佈局:Play中存在部分視圖?
@(title: String)(content: => Html)(implicit flash: Flash)
<!DOCTYPE html>
<html>
<head>
<title>@title</title>
</head>
<body>
<section class="content">@content</section>
</body>
</html>
而且還有layouts/_footer.scala.html
「部分」,我怎麼包括_footer
爲main
? Play中有沒有類似的東西?
如何玩知道@footer定義在哪裏? –
@Alex在這種情況下,必須在'views.html'命名空間中定義'@ footer',它將爲Play模板自動導入。如果它位於'app/views/common/footer.scala.html'中,那麼它就是'common.footer()'。 –