hiding empty fields

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 3, 2010   (RSS)

By steve_e - March 2, 2010

Hi -
Is there a built-in CMS Builder way to automatically not show fields with no content in them, or do we need to do this ourselves with PHP? Can't see any option that says 'miss this line out if there's nothing in it' or something similar...'.

Re: [steve_e] hiding empty fields

By Chris - March 2, 2010

Hi steve_e,

You'll need to do this in PHP, but it's really quite easy. Simply replace this:

Field: <?php echo $record['field'] ?>

with this:

<?php if ($record['field']): ?>
Field: <?php echo $record['field'] ?>
<?php endif ?>


I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [steve_e] hiding empty fields

By Chris - March 3, 2010

Hi steve_e,

It does seem that a lot of people want their Code Generated pages to work like this out-of-the-box. I'll make sure our feature request list reflects that. Thanks for the feedback. :)
All the best,
Chris