title: Scala Play load partial template by String name
body: <p>I have a Scala template like this...</p>
  
  <pre><code>@()
  import view.html.partials._header
  import view.html.partials._footer
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
      @_header()
  
      /* Body of web page */
  
      @_footer
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Every single page has the same header and footer and a different body. I do not want to do this...</p>
  
  <p>Page #1...</p>
  
  <pre><code>@()
  import view.html.partials._header
  import view.html.partials._footer
  import view.html.partials._body1
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      @_header()
      @_body1()
      @_footer
  &lt;/html&gt;
  </code></pre>
  
  <p>Page #2...</p>
  
  <pre><code>@()
  import view.html.partials._header
  import view.html.partials._footer
  import view.html.partials._body2
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      @_header()
      @_body2()
      @_footer
  &lt;/html&gt;
  </code></pre>
  
  <p>Page #3...</p>
  
  <pre><code>@()
  import view.html.partials._header
  import view.html.partials._footer
  import view.html.partials._body3
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      @_header()
      @_body3()
      @_footer
  &lt;/html&gt;
  </code></pre>
  
  <p>Etc.</p>
  
  <p>Is there a way to pass in the name of the partial template you want to render as a parameter? What is the solution to this problem?</p>
  
  <p>p.s. I don't see the solution in... <a href="https://www.playframework.com/documentation/2.0/ScalaTemplates" rel="nofollow">the play template documentation</a></p>