Problem with News Module Custom fields
Posted: Tue Oct 16, 2018 3:38 pm
I have three custom fields in my news module. They are called image, image2 and image3.
I'm not able to call any of them individually except the 'image' one the other donĀ“t show up if I call them.
this is the code I'm using to call the custom fields
for some reason this code only works for the 'image' custom-field.
Obviously I can see all the three images if I use this loop below.
But if I want to display the images from the custom field separately I get into troubles as I described above.
Can anyone here hlep me figuring this out.
I'm not able to call any of them individually except the 'image' one the other donĀ“t show up if I call them.
this is the code I'm using to call the custom fields
Code: Select all
<img src="{$entry->file_location}/{$entry->fields.image->value}"/>
<img src="{$entry->file_location}/{$entry->fields.image2->value}"/>
<img src="{$entry->file_location}/{$entry->fields.image3->value}"/>
Obviously I can see all the three images if I use this loop below.
Code: Select all
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="PostImg">
{if $field->type == 'file'}
{* this template assumes that every file uploaded is an image of some sort, because News doesn't distinguish *}
{if isset($field->value) && $field->value}
<img src="{$entry->file_location}/{$field->value}"/>
{/if}
{else}
{$field->name}: {$field->value}
{/if}
</div>
{/foreach}
{/if}
But if I want to display the images from the custom field separately I get into troubles as I described above.
Can anyone here hlep me figuring this out.