title: Twig equality if..else in symfony 2 gives both results
body: <p>I'm using Symfony2 with Twig and when trying to determine the class that should be a div Twig says that <strong>all 4 classes are active</strong> even beeing in an if..else clause.
  Redirect has only 1 value. I checked the syntax and I think it's correct so maybe I'm missing something.</p>
  
  <p>It's correct my code or is something wrong in the Twig comparision (equality or if..else clause)?</p>
  
  <p>Here is the Twig code:</p>
  
  <pre><code>{% if redirect == 'a' %}
      {% block classA 'active' %}
  {% elseif redirect == 'b' %}
      {% block classB 'active' %}
  {% elseif redirect == 'c' %}
      {% block classC 'active' %}
  {% else %}
      {% block classD 'active' %}
  {% endif %}
  </code></pre>
  
  <p>And the controller code:</p>
  
  <pre><code>[...]
  $redirect = "a";
  
  return $this-&gt;render('FrontendBundle:Default:delete.html.twig', array(
      'id' =&gt; $id,
      'redirect' =&gt; $redirect,
      'text' =&gt; $text)
  );
  </code></pre>
  
  <p><strong>Edited.</strong></p>
  
  <p><strong>Solution</strong></p>
  
  <p>I found that it's not possible to use if clauses out of a block, so the solution goes ahead using one block for each class.</p>
  
  <p>I've also thought that a better solution would be to use a dynamic name block, but i read that's not possible.</p>
  
  <p>Finally I found this that solve my problem in a different way: <a href="http://peter-hoffmann.com/2012/highlight-active-menu-item-with-twig-and-silex.html" rel="nofollow">http://peter-hoffmann.com/2012/highlight-active-menu-item-with-twig-and-silex.html</a></p>
  
  <p>Kind regards.</p>