How to hide a DIV if ther's no value in that Content in a node--customtpl.tpl.php file How can I hide a DIV if ther's no value in that Content in a node--customtpl.tpl.php file? I have used a code something like this, but if hides everything weather it has data or not. Can anyone help me with this code?

I want to hide this "special-offer" div if there's no value in that field in drupal (this_is_a_drupal_field).

&lt;?php
if ($content['this_is_a_drupal_field']) 
  {
  print "&lt;div class='special-offer'&gt;";
  print render($content['this_is_a_drupal_field']); 
  print "&lt;/div&gt;";
  }
?&gt;

&lt;?php if(empty($content['this_is_a_drupal_field'])){ ?&gt;
Your if statement needs a condition, ex: 'greater than' &gt; 'less than' &lt; 'equal to' == or 'not equal to' !=

The special NULL value represents a variable with no value.

So try:

&lt;?php if ($content['this_is_a_drupal_field'] != NULL): ?&gt;
  &lt;div class='special-offer'&gt;
    &lt;?php print render($content['this_is_a_drupal_field']); ?&gt;
  &lt;/div&gt;
&lt;?php endif; ?&gt;


So basically we're saying if $content['this_is_a_drupal_field'] is not equal to empty print...