Do not output label when content empty

gausarts - October 4, 2009 - 08:51
Project:Views Bonus Pack
Version:6.x-1.0-beta4
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I created a CUSTOM label for each field in my xml export via views UI. I put a condition to check if the content is there in views-bonus-export-xml.tpl, and do not want to print the label when empty:

<?php foreach ($row as $field => $content): ?>
<?php if (!empty($content)): ?>
<?php $label = $header[$field] ? $header[$field] : $field; ?>
    <<?php print $label; ?>><?php print $content; ?></<?php print $label; ?>>
<?php endif; ?>
<?php endforeach; ?>

I think I have tried to give any possible variations, but no matter what I failed. The label is still printed even when the content is empty. So how exactly to remove row (or its label) when the field content is empty in this particular template?

Any suggestion? Thanks

 
 

Drupal is a registered trademark of Dries Buytaert.