Page 1 of 1
[fixed?] News summary template {if} statement not working
Posted: Mon Jul 09, 2012 12:39 pm
by cb2004
This is in the release package of BETA 3. Works ok on BETA 2 but not now. The Do something would show if a file type field called Image does not have anything set.
Code: Select all
{if isset($entry->fields.Image) && $entry->fields.Image->value != ''}Do something{/if}
Re: News summary template {if} statement not working
Posted: Fri Jul 13, 2012 9:34 am
by uniqu3
Code: Select all
<strong>{if isset($entry->fields.Test)}Field test: {$entry->fields.Test->value}{/if}</strong>
Works for me just fine rev 8174
Re: News summary template {if} statement not working
Posted: Sun Jul 22, 2012 7:35 am
by Jean le Chauve
If a file type field called Image does not have anything set, it return the id of the field in
the detail template (work in the summary template), so I use now :
Code: Select all
{foreach from=$entry->fields item='field'}
{if $field->name == 'image' && $field->value neq '1'}
Re: News summary template {if} statement not working
Posted: Sun Jul 22, 2012 4:22 pm
by calguy1000
Standard template issue works fine for me.
Re: News summary template {if} statement not working
Posted: Sun Jul 22, 2012 7:07 pm
by Jean le Chauve
Yes, it works if you have only 1 field.
Put 2 custom text fields (first = image), let the first empty and put a valor into second.
If you put
Code: Select all
{$field->name}: {eval var=$field->value}
<strong>{if isset($entry->fields.image)}Field test: {$entry->fields.image->value}{/if}</strong>
{$entry->fields.image->value} return : 1 (his id) and your condition don't work.
Re: News summary template {if} statement not working
Posted: Mon Jul 23, 2012 12:39 pm
by Stikki
Fixed, thanks for reporting.
-Stikki-
Re: [fixed?] News summary template {if} statement not workin
Posted: Tue Jul 24, 2012 4:57 pm
by Jean le Chauve
Not fixed in 8193 detail template
Re: [fixed?] News summary template {if} statement not workin
Posted: Tue Jul 24, 2012 5:08 pm
by Stikki
Works with revision 8196.
At least for me. test again.
-Stikki-
Re: [fixed?] News summary template {if} statement not workin
Posted: Tue Jul 24, 2012 5:16 pm
by calguy1000
I just tested... and made a minor adjustment.
Summary view now works exactly the same way as detail view wrt custom fields.
Re: [fixed?] News summary template {if} statement not workin
Posted: Tue Jul 24, 2012 5:57 pm
by Jean le Chauve
Ok, with a new install 8198, the id of the empty field don't more appear
But, you cannot use this condition for test if a field is empty <strong>{if isset($entry->fields.fieldname)}This appear only if image is not empty{/if}</strong>
You must now use <strong>{if isset($entry->fields.image
->value)}This appear only if image is not empty{/if}</strong>
The condition code from uniq3 don't work.
Re: [fixed?] News summary template {if} statement not workin
Posted: Tue Jul 24, 2012 6:06 pm
by Stikki
As far as i know, you never could.
As field always exists if it's there, if it has value or not is other case.
-Stikki-
Re: [fixed?] News summary template {if} statement not workin
Posted: Tue Jul 24, 2012 6:16 pm
by Jean le Chauve
You're right. It's fixed for mee too.