Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 14, 20159 yr So I've got several fields in my database that I'm not requiring my staff to fill out. So it's an optional database field, essentially. When it comes to displaying this on the front end - can someone tell me the "Custom Display Format" that would hide this field if nothing is filled in. Then display the field if the staff member had put content into that optional database field. Thanks!
December 14, 20159 yr Author 18 minutes ago, opentype said: {{if $formValue}} {{endif}} Though this does seem to work - it still leaves a space (<br>) even though there is no data displayed. Is there a way to eliminate it?
December 14, 20159 yr Probably, but hard to say where this is coming from without looking at all the involved templates and settings.
December 14, 20159 yr Author {$record->customFieldDisplayByKey('2015', 'display')|raw} <br> {$record->customFieldDisplayByKey('2014', 'display')|raw} <br> {$record->customFieldDisplayByKey('2013', 'display')|raw} <br> {$record->customFieldDisplayByKey('2012', 'display')|raw} <br> {$record->customFieldDisplayByKey('2011', 'display')|raw} This is what I have showing on the template ^^^ Then below is what I have on the "Display Custom Format" inside the database field settings... {{if $formValue}}<b>{$label}:</b> {$value}{{endif}} - this is the same for each field listed above, (2015, 2014, 2013, 2012, 2011)
December 14, 20159 yr Oh, I see. You put the break in there yourself! ;-) Just make it part of the IF statement then, e.g. {{if $formValue}}<b>{$label}:</b> {$value}<br>{{endif}}
December 16, 20159 yr Author That makes too much sense. Thanks @opentype - definitely nice to have a second eye on things.
Archived
This topic is now archived and is closed to further replies.