user3231931
user3231931

Reputation: 331

play framework - about multiple main layout template

Do you know how to create and use different main layout in play framework?

Or please tell me how the template view finds the main layout view, is the "main" layout name fixed? can change the "main" name?

Upvotes: 0

Views: 910

Answers (1)

Seb Cesbron
Seb Cesbron

Reputation: 3833

Templates are different between play1 and play2 so the answer depends on your version

In play2 see the layout section in the doc (http://www.playframework.com/documentation/2.2.x/ScalaTemplateUseCases). You specify the name of the layout in your template

@main(title = "Home") {

  <h1>Home page</h1>

}

so for a different template

@different(title = "Home") {

  <h1>Home page</h1>

}

and you define you layout in different.scala.html

Upvotes: 4

Related Questions