Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
jhutch Posted December 14, 2015 Posted December 14, 2015 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!
jhutch Posted December 14, 2015 Author Posted December 14, 2015 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?
opentype Posted December 14, 2015 Posted December 14, 2015 Probably, but hard to say where this is coming from without looking at all the involved templates and settings.
jhutch Posted December 14, 2015 Author Posted December 14, 2015 {$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)
opentype Posted December 14, 2015 Posted December 14, 2015 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}}
jhutch Posted December 16, 2015 Author Posted December 16, 2015 That makes too much sense. Thanks @opentype - definitely nice to have a second eye on things.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.