The Templating system
Play 2.0 內嵌 Scala為基的模版引擊, 這個模版的設計概念來自 ASP.NET.
compact, expressive, and fluid: it minimizes the number of characters and keystrokes required in a file, and enables a fast, fluid coding workflow. Unlike most template syntaxes, you do not need to interrupt your coding to explicitly denote server blocks within your HTML. The parser is smart enough to infer this from your code. This enables a really compact and expressive syntax which is clean, fast and fun to type.
easy to learn: it enables you to quickly be productive with a minimum of concepts. You use all your existing Scala language and HTML skills.
not a new language: we consciously chose not to create a new language. Instead we wanted to enable developers to use their existing Scala language skills, and deliver a template markup syntax that enables an awesome HTML construction workflow with your language of choice.
editable in any text editor: it doesn’t require a specific tool and enables you to be productive in any plain old text editor.
模版會被編譯成標準的Scala函數, 例如您建立了一個 views/Application/index.scala.html 模版檔, 它將被產出一個 views.html.Application.index 函數.
API: play.api.templates.Html, http://playframework.github.com/api/scala/play/api/templates/Html.html
Syntax: the magic ‘@’ character
Because @ is a special character, you’ll sometimes need to escape it. Do this by using @@:
My email is bob@@example.com