How to avoid displaying fields with empty data?
3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 9, 2021 (RSS)
By mark99 - April 9, 2021
Quick question. Let's say I'm outputting some fields into the public page (could be a textfield or list etc.), but one of my fields has no data inserted and is thus unnecessary to display. Is there a way to only output the field if it actually has data in (i.e. don't display it if the field has no data / is empty in the database)?
By Deborah - April 9, 2021
Yes, mark99, you can do that. Here's an example for a list page record:
<?php if ($record['summary']): // show only if field contains content ?>
<p><?php echo $record['summary']; ?></p>
<?php endif ?>
~ Deborah