title: Difference between Include, Extends, Use, Macro, Embed in Twig
body: <p>What is the difference between <code>use</code> and <code>include</code> in Twig?</p>
  
  <h1><a href="http://twig.sensiolabs.org/documentation" rel="noreferrer">Documentation</a>:</h1>
  
  <blockquote>
    <h2>include</h2>
    
    <p>The <code>include</code> statement includes a template and returns the rendered content of that template into the current one:</p>
  
  <pre><code>￼{% include 'header.html' %}
  Body here...
  {% include 'footer.html' %}
  </code></pre>
    
    <h2>use</h2>
    
    <p>The <code>use</code> statement tells Twig to import the blocks defined in <code>blocks.html</code> into the current template (it's like macros, but for blocks):</p>
    
    <p><strong><em>blocks.html</em></strong></p>
  
  <pre><code>{% block sidebar %}{% endblock %}
  </code></pre>
    
    <p><strong><em>main.html</em></strong></p>
  
  <pre><code>{% extends "base.html" %}
  {% use "blocks.html" %}
  {% block title %}{% endblock %}
  {% block content %}{% endblock %}
  </code></pre>
  </blockquote>
  
  <hr>
  
  <h1>Possible answer:</h1>
  
  <p>I think <a href="https://groups.google.com/forum/#!topic/twig-users/f9Vac21WeVk" rel="noreferrer">this</a> should explain the difference:</p>
  
  <blockquote>
    <p><code>include</code> is to get all the code from an external file and import it 
    into your actual file at the right location of the call. </p>
    
    <p><code>use</code> is completely different as it parses the linked file to find a 
    particular section of code and then overwrites the blocks with the 
    same name, in your current file, with the one found in this external 
    file. </p>
    
    <p><code>include</code> is like "<strong>go find this file and render it with my page here</strong>". </p>
    
    <p><code>use</code> is "<strong>parse this other file to find block definitions to use instead 
    of my owns defined here</strong>". </p>
    
    <p>If <code>use</code> command finds nothing matching the task, nothing is displayed 
    at all from this file.</p>
  </blockquote>
  
  <hr>
  
  <h1>Question</h1>
  
  <p>is the explanation correct? are there any other explanations to this difference?</p>