I need to print some html in a node tpl file if a certain field is not empty. The follwing is giving me a white screen:

<?php if (!empty($content['field_hotel_sat_nav'])) {
                        print '<h1>The field is not empty</h1>'
  • 2
    The white screen would surely be caused by the missing semi-colon at the end of the print statement...nothing wrong with the call to empty()
    – Clive
    Apr 24, 2013 at 15:59

1 Answer 1


Try this code:

  if ($content['field_hotel_sat_nav'] != '') { 

    //Do something 


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.