Invision Community 5: A video walkthrough creating a custom theme and homepage By Matt Thursday at 04:02 PM
action-reaction Posted September 25, 2015 Posted September 25, 2015 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 ?
action-reaction Posted September 25, 2015 Author Posted September 25, 2015 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.
Paul.F Posted September 25, 2015 Posted September 25, 2015 Odd. If one of my fields has no data then it isn't displayed by default. Can you link the page?
action-reaction Posted September 25, 2015 Author Posted September 25, 2015 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.
action-reaction Posted September 25, 2015 Author Posted September 25, 2015 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
action-reaction Posted September 25, 2015 Author Posted September 25, 2015 There is probably something to do with that line : {{foreach $record->customFieldsForDisplay('display') as $fieldId => $fieldValue}} But what's the good grammar... ?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.