Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 25, 20159 yr 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 ?
September 25, 20159 yr Author I'm sorry for that up', but I need an answer and it will be useful for other members, anyway. I tried this, also : <if test="{$record->customFieldDisplayByKey('field_16')|raw}"> </if> It doesn't work, neither.
September 25, 20159 yr Odd. If one of my fields has no data then it isn't displayed by default. Can you link the page?
September 25, 20159 yr Author Ah... The fact is that I don't use the default template. Instead, I display each field like that, to get my own view : {$record->customFieldDisplayByKey('field_1')|raw} Thank you for your reply, by the way.
September 25, 20159 yr Author 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
September 25, 20159 yr Author There is probably something to do with that line : {{foreach $record->customFieldsForDisplay('display') as $fieldId => $fieldValue}} But what's the good grammar... ?
Archived
This topic is now archived and is closed to further replies.