tenaki Posted October 17, 2015 Share Posted October 17, 2015 Trying to use custom fields in a record template {$record->customFieldDisplayByKey('fuel', 'listing')|raw} How would I use the above with the {{if}} statement So that when the field is empty it is not displayed in template Link to comment Share on other sites More sharing options...
tenaki Posted October 18, 2015 Author Share Posted October 18, 2015 Where is Marcher when you need him Can't make it work Tried {{ if $record->customFieldDisplayByKey('additional-image_136_137_138') }} {$record->customFieldDisplayByKey('additional-image_136_137_138', 'display')|raw} {{ endif }} And get an config error Just trying to hide empty fields Link to comment Share on other sites More sharing options...
Meddysong Posted October 18, 2015 Share Posted October 18, 2015 Try {{if count( $row->customFieldDisplayByKey('fuel','listing') )}}. In one of my templates I have <div class='ipsDataItem_main'>{{if count( $row->customFieldDisplayByKey('area','listing') )}} <div class='ipsDataItem_meta'> {$row->customFieldDisplayByKey('area', 'listing')|raw} </div> {{endif}} and it's doing the job. Link to comment Share on other sites More sharing options...
tenaki Posted October 18, 2015 Author Share Posted October 18, 2015 Excellent thank you I had to just alter your code a bit to make it work in display templates {{if count( $record->customFieldDisplayByKey('field_additional-image_136_137_138','display') )}} {$record->customFieldDisplayByKey('field_additional-image_136_137_138', 'display')|raw} {{endif}} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.