Jump to content

[Pages] How do you test if a field is empty ?


action-reaction

Recommended Posts

Hello,

In the records templates, I need to hide a field if it's empty.
Before the 4.0, it was possible to do that :

<if test="$data['record']['field_17']">{$data['record']['field_17']}</if>

Since the 4.0, this doesn't work.
I tried this without success : 

  <if test="{customFieldDisplayByKey('field_17')">

 

 

So, how to hide a field, if it's empty, please ?

 

 

Link to comment
Share on other sites

Eh eh, I think I have found the solution, by doing something like that :

	{{if $fieldValue}}{$record->customFieldDisplayByKey('field_1')|raw} 
<div class="contenu">
  	<h2 align="center" class=' ipsType_sectionTitle ipsType_reset ipsType_blendLinks'>
    Bibliographie
      </h2>
    
  <br>
   {$record->customFieldDisplayByKey('field_2')|raw}
   {{endif}}

 

 

**edit**

No, this is unperfect, because the first $record-> is not only evaluated, but also displayed :(

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...