title: Best practices to create a Twig HTML Layout (Masterpage)
body: <p>I have been developing <code>C#/ASP.net</code> MVC-App for 5 years and I am now learning <code>PHP</code>.</p>
  
  <p>In <code>C#</code>, I can use <code>RenderBody</code> for each new site, so the new HTML content will be replaced in <code>RenderBody()</code>. Then, I have only one new partial view and one new controller for each site:</p>
  
  <pre><code> &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;RenderBody()&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When using Twig, I have a skeleton Layout:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;{%block ablock%}{%endblock%}&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>For every new site, I need to make a new <code>child.twig</code> file and extend the main layout, then override the 'ablock'. By doing it this way, I still need a PHP file (let's call them <code>index1.php</code>, <code>index2.php</code>, etc) which calls the twig load functions with the <code>child.twig</code> as a parameter. In the end, I have to create 2 views (the <code>child.twig</code> + <code>index.php</code>) and one more php file for the controller. So my question is :</p>
  
  <p><strong>What is the best way to create an HTML-Masterpage in MVC with Twig?</strong></p>
  
  <p>I could not find any public project / tutorial mentioning the best practices to do this.</p>
  
  <p>Thanks in advance.</p>