title: How to display layout content in Twig template based on a view
body: <p>I have some content in my layout that are not supposed to be displayed in some pages.</p>
  
  <p>E.g.: When a user is registering for the site my default frontpage sidebar should not be displayed:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          {% block head %}
              &lt;link rel="stylesheet" href="style.css" /&gt;
              &lt;title&gt;{% block title %}{% endblock %} - My Webpage&lt;/title&gt;
          {% endblock %}
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="content"&gt;
             &lt;div id="sidebar"&gt;
                 {% block sidebar %}
                     {% render "/layout/sidebar" %}
                 {% endblock %}
                 {% block content %}{% endblock %}
             &lt;/div&gt;
  
          &lt;/div&gt;
          &lt;div id="footer"&gt;
              {% block footer %}
                  &amp;copy; Copyright 2011 by &lt;a href="http://domain.invalid/"&gt;you&lt;/a&gt;.
              {% endblock %}
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In the above code:</p>
  
  <pre><code> {% block sidebar %}
  </code></pre>
  
  <p>should display some advertising instead!</p>
  
  <p>So:</p>
  
  <p>Something like:</p>
  
  <pre><code>{% if SOMEVIEW == TRUE %}
      {% block sidebar %}
  {% else %}
      {% block advertising %}
  {% endif %}
  </code></pre>
  
  <p>What expression could I use in my IF to accomplish that job?</p>
  
  <p>Thanks in advance</p>