Normally, my situation is easily solved using views rewrite feature. However, in this case I am unable to use views rewrite because I have data attribute tags in the field wrappers that are stripped out by views. So I need to handle this at the template level. I have no problem with the field data itself, but with the field wrappers. I need to use php if statements in either views-view-field.tpl.php or views-view-field.tpl.php to enclose the wrapper html too along with the field. But i can't figure out the php syntax to use to accomplish this. I need to be able to show the field data plus wrappers if the field has content, but show some empty field without the wrappers if there is no data.
so far i have tried things like views-view-field.tpl.php
<?php if ($output): ?> <p class="tms-caption font-alt-1 text-medium weight-light color-white hide-on-mobile mb-30" data-animate-in="preset:slideInDownShort;duration:900ms;delay:500ms;" data-no-scale><?php print $output; ?></p> <div class="clear"></div> <?php elseif ($empty($output)): ?> <div class="view-empty"> <?php print $empty; ?> </div> <?php endif; ?>
How can i revise my if statements to it works in either fields or field.tpl.php?