title: Simple Twig IF statement with variable in Symfony2
body: <p>I'm trying to only include some HTML based on an IF statement:</p>
  
  <pre><code>{% if "{{ app.request.attributes.get('var_name') }}" != "" %}
  &lt;meta id="var_name" content="{{ app.request.attributes.get('var_name') }}" /&gt;
  {% endif %}
  </code></pre>
  
  <p>The above will work exactly as expected if the var_name variable holds data, but if it is empty or not defined it always returns the HTML like this:</p>
  
  <pre><code>&lt;meta id="var_name" content="" /&gt;
  </code></pre>
  
  <p>...so basically it is registering the IF statement as true, even though there's nothing to show.</p>
  
  <p>It makes no difference if the variable is defined or not.</p>
  
  <p>Also, this:</p>
  
  <pre><code>{% if {{ app.request.attributes.get('var_name') }} != "" %}
  </code></pre>
  
  <p>...returns this error:</p>
  
  <p>A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{" in...</p>
  
  <p>How do I do it?</p>