title: include scala.html files in play 2.0 scala
body: <p>I am trying to learn Play 2.0 with scala but I dont think i quite understand how the template system for play 2.0 works. I have used play 1.2 before and i am sort of looking for an equivalent to the #{include 'views/blah.html' /}. I essentially want to create a navbar that is rendered on all the pages.</p>
  
  <p>Essentially in main.scala.html i have </p>
  
  <pre><code>@(title: String)(navbar: Html)(content: Html)
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;@title&lt;/title&gt;
      &lt;link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")"&gt;
      &lt;link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")"&gt;
      &lt;script src="@routes.Assets.at("javascripts/jquery-1.7.1.min.js")" type="text/javascript"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;header&gt;
      This is my header
    &lt;/header&gt;
      &lt;section class="navbar"&gt;@navbar&lt;/section&gt;
      &lt;section class="content"&gt;@content&lt;/section&gt;
    &lt;footer&gt;
      This is my footer
    &lt;/footer&gt;
  </code></pre>
  
  <p></p>
  
  <p>and in my index.scala.html:</p>
  
  <pre><code>@navbar = {  
  &lt;h1&gt;Index&lt;/h1&gt;
  &lt;ul&gt;
      &lt;li&gt; 
          &lt;a href=@routes.Application.tasks&gt;Tasks&lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  }
  @main("Home")(navbar){
    content
  }
  </code></pre>
  
  <p>in task.scala.html:</p>
  
  <pre><code>@(tasks: List[Task], taskForm: Form[String]) 
  @import helper._
  @main("Home") {
  &lt;h1&gt;Index&lt;/h1&gt;
  &lt;ul&gt;
      &lt;li&gt; 
          &lt;a href=@routes.Application.tasks&gt;Tasks&lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  } {
    task code
  }
  </code></pre>
  
  <p>Now to include this navbar it seems i have to repeat this in every page this way i would have to hard code this navbar into every page. Is there a way to do this without without writing the whole navbar in every page?</p>
  
  <p>I have also tried creating a navbar.scala.html file that contains</p>
  
  <pre><code>&lt;h1&gt;Index&lt;/h1&gt;
  &lt;ul&gt;
      &lt;li&gt; 
          &lt;a href=@routes.Application.tasks&gt;Tasks&lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>and saving under views/ then importing that using <code>@import views.navbar</code> but then i get an error stating 'navbar is not a member of views'. I am writing this in Eclipse Java EE IDE indigo if that helps.</p>