hide content if empty text field

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 4, 2012   (RSS)

By s2smedia - April 4, 2012

I have a "staff" section on a website.. each staff member has a bio and accomplishments tab on their page.

Alot of the staffers do not have any accomplishments listed therefor do not want the accomplishments tab shown.

is there a way to only display this tab is there is text in the "accomplishments" field?

Re: [s2smedia] hide content if empty text field

By (Deleted User) - April 4, 2012

Hi s2smedia,

Assuming that the field for 'accomplishments' is titled the same, you could use this:
if (@$record['accomplishments']) { //show accomplishments box}

This will check to see if anything exists in the accomplishments field and, if so, will output whatever you need to output. If not, the errors caused will be suppressed (the '@' symbol does that) and the code will continue as if nothing is wrong.

Let me know if this helps,

Tom