title: symfony twig extends: 'only extend if'
body: <p>In twig there is the 'extends' tag, as found here; <a href="http://twig.sensiolabs.org/doc/tags/extends.html#conditional-inheritance" rel="nofollow">http://twig.sensiolabs.org/doc/tags/extends.html#conditional-inheritance</a></p>
  
  <p>Now what I wanna do is something along the lines of the following example from that page:</p>
  
  <pre><code>{% extends standalone ? "minimum.html" : "base.html" %}
  </code></pre>
  
  <p>But rather than having 2 templates to extend from, I just want to extend from a template if a specific condition is met.</p>
  
  <p>Now I've tried things such as:</p>
  
  <pre><code>{% extends boolean ? "template.html.twig" : "" %}
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>{% if boolean %}
      {% extends "template.html.twig" %}
  {% endif %}
  </code></pre>
  
  <p>but the former gives an error saying it cannot find a template (since "" obviously isnt a valid path), and the latter just doesn't appear to do anything at all (or rather, it loads for a while and ends up not showing anything)</p>
  
  <p>I've tried some other approaches, but couldn't come up with anything, so figured I'd ask here if I might be missing something.</p>
  
  <p>Thanks in advance for any replies :)</p>
  
  <p>EDIT: To sum up my intent; I am wondering if I can tell my template to only extend if a certain condition is met, and otherwise skip the extend step. (if condition then extend else do nothing)</p>