# Common template use cases
Templates, being simple functions, can be composed in any way you want. Below are a few examples of some common scenarios.
## Layout
Let’s declare a `views/main.scala.html` template that will act as a main layout template:
```html
@(title: String)(content: Html)
@title@content
```
As you can see, this template takes two parameters: a title and an HTML content block. Now we can use it from another `views/Application/index.scala.html` template:
```html
@main(title = "Home") {
Home page
}
```
> **Note:** You can use both named parameters (like `@main(title = "Home")` and positional parameters, like `@main("Home")`. Choose whichever is clearer in a specific context.
Sometimes you need a second page-specific content block for a sidebar or breadcrumb trail, for example. You can do this with an additional parameter:
```html
@(title: String)(sidebar: Html)(content: Html)
@title@content@sidebar
```
Using this from our ‘index’ template, we have:
```html
@main("Home") {
Sidebar
} {
Home page
}
```
Alternatively, we can declare the sidebar block separately:
```html
@sidebar = {
Sidebar
}
@main("Home")(sidebar) {
Home page
}
```
## Tags (they are just functions right?)
Let’s write a simple `views/tags/notice.scala.html` tag that displays an HTML notice:
```html
@(level: String = "error")(body: (String) => Html)
@level match {
case "success" => {
@body("green")
}
case "warning" => {
@body("orange")
}
case "error" => {
@body("red")
}
}
```
And now let’s use it from another template:
```html
@import tags._
@notice("error") { color =>
Oops, something is wrong
}
```
## Includes
Again, there’s nothing special here. You can just call any other template you like (or in fact any other function, wherever it is defined):
```html
Home
@common.sideBar()
```
## moreScripts and moreStyles equivalents
To define old moreScripts or moreStyles variables equivalents (like on Play! 1.x) on a Scala template, you can define a variable in the main template like this :
```html
@(title: String, scripts: Html = Html(""))(content: Html)
@title
@scripts
```
And on an extended template that need an extra script :
```html
@scripts = {
}
@main("Title",scripts){
Html content here ...
}
```
And on an extended template that not need an extra script, just like this :
```html
@main("Title"){
Html content here ...
}
```
> **Next:** [[HTTP form submission and validation | JavaForms]]