how to customize my views-view-table.tpl.php? i have a view table for property list and i want to customize the view source code to make it print specific label that i add from inside of view in the administration

the view source code :

&lt;thead&gt;
  &lt;tr&gt;
    &lt;?php foreach ($header as $field =&gt; $label): ?&gt;
      &lt;th &lt;?php if ($header_classes[$field]) { print 'class="'. $header_classes[$field] . '" '; } ?&gt; scope="col"&gt;
        &lt;?php print $label; ?&gt;
      &lt;/th&gt;
    &lt;?php endforeach; ?&gt;
  &lt;/tr&gt;
&lt;/thead&gt;


but this code print all fields labels even its empty! 

output :

the output that i need like this :



any suggestion to update the code ?
The best way is to use field_info_instance($entity_type, $field_name, $bundle_name)to get information about specific instance of a field. The label of the field is contained in the array returned from that function.

The general code : 

&lt;?php
 $info = field_info_instance($entity_type, $field_name, $bundle_name);
 print $info['label'];
    ?&gt; :

in my situation : 

&lt;?php
 $info = field_info_instance('node','property_photo','property');
 print $info['label'];
    ?&gt; :

OR 

by Using this Code :

&lt;?php print $header['$field_name']; ?&gt; :


in my situation :

    &lt;?php print $header['property_photo']; ?&gt; :


that's it .