emeric73 Posted May 15, 2021 Posted May 15, 2021 (edited) Hello, On a personalize display, what is the solution so that empty fields without data are not displayed on the page? My current code which even displays the fields when there is no data <article class='ipsContained ipsResponsive_pull'> <div class='ipsClearfix'> <h1 class="ipsType_pageTitle ipsContained_container"><i class="fa fa-info-circle" aria-hidden="true"></i> Présentation</h1> <hr class="ipsHr"> {$record->customFieldDisplayByKey('date-fabrication', 'display')|raw}<br><br> {$record->customFieldDisplayByKey('propriétaire', 'display')|raw}<br> {$record->customFieldDisplayByKey('statut', 'display')|raw}<br> {$record->customFieldDisplayByKey('constructeur', 'display')|raw}<br> {$record->customFieldDisplayByKey('Peintre', 'display')|raw}<br> {$record->customFieldDisplayByKey('modèle', 'display')|raw}<br><br> {$record->customFieldDisplayByKey('sitewebpb', 'display')|raw}<br> {$record->customFieldDisplayByKey('réseau-socialpb', 'display')|raw} <hr class="ipsHr"> </div> </article> Thank you for your help. Edited May 15, 2021 by emeric73
opentype Posted May 16, 2021 Posted May 16, 2021 Normally, you would wrap it in an IF query: {{if $variable}}{$variable}{{endif}} This can still cause problems with some fiel types, since they can return something even if nothing was added to the field. The better solution is to define the output in the field settings itself. There you can check for content like this: {{if $formValue}}{$value}{{endif}} emeric73 1
emeric73 Posted May 24, 2021 Author Posted May 24, 2021 Hello, Thanks for your feedback. This type of request is not possible to be directly to the model? When I use it directly in the field parameter it works but keeps the line breaks on the display. {{if $formValue}}<span class="ipsBadge ipsBadge_large ipsBadge_style12"><i class="fa fa-arrows-h" aria-hidden="true"></i> {$label} :</span><span class="ipsBadge_large"> {$value}</span>{{endif}} I'm stupid I must delete but line break and add them directly to the field parameter. Thanks again for your help.
Jimi Wikman Posted May 26, 2021 Posted May 26, 2021 Maybe this will help?https://jimiwikman.se/ips/ips-customization/ips-pages/database-templates/category-list/show-cusom-field-with-condition-r3/ emeric73 and SeNioR- 1 1
Recommended Posts