Ton van Loon
When I want to show the contents of a custom media field in a relative complex code << using {if} and/or nested if's with {article-nested id="[id]"} >> somehow the code exection gets messed up.
Config:
- Joomla 4.0.3
- Article Anywhere v11.1.1-dev2165300
Situation:
- Based on conditions, I want to show images from custom media fields in a known article (id=64 / title= instellingen)
- Conditions:
-- status:
- 0: evaluate dates to determine 1 2 or 3
- 1: outcome = rehearsing
- 2: outcome = uitvoering
- 3: outcome = uitgevoerd
- 4: outcome = gecancelled
-- if status = 0 -> evaluate 2 dates: << datum-eerste-uitvoering && datum-laatste-uitvoering >> to determine 1 2 or 3
- Status 1 2 3 and 4 each have its own image file in its own custom media field [rehearsing] [uitvoering] [uitgevoerd] [gecancelled] in config-article id=64
When I only use a TEXTUAL outcome, the above evaluatrion goes right. But when I want a IMAGE outcome, it goes wrong and it seems to mess up the article-referencing
It wrote test cases, to find out what is happening.
TEST CODE 1: straight forward referencingThis article: test referencing bij id en by title / 67
Title: {article}[title]{/article}
ID: {article}[id]{/article}
Other article: instellingen / 64
Title (ref by ID): {article id="64"}[title]{/article}
ID (ref by title): {article title="instellingen"}[id]{/article}
Outcome: as expected.
TESTCODE 2: more complex{article}
INPUT:
today is: 11-11-2021 ( 11 november 2021)
first-date is: [datum-eerste-uitvoering]
last-date is: [datum-laatste-uitvoering]
Status-value: [status:value]
Checking referencing config-article "instellingen" / id=64:
config-article-ID (ref by title): {article title="instellingen"}[id]{/article}
config-article-TITLE (ref by id): {article id="64"}[title]{/article}
Checking 'contents of dummy-text-field' from config-article "instellingen" / id=64:
dummy-text-field (ref'd by title=instellingen): {article title="instellingen"}[dummy-text-field]{/article}
dummy-text-field (ref'd by id=64): {article id="64"}[dummy-text-field]{/article}
Checking 'status Image URL' from config-article "instellingen" / id=64:
a) Referencing by ID:
{if status='1'}{article id="64" }[rehearsing:url]{/article}{/if}
{if status='2'}{article id="64"}[uitvoering:url]{/article}{/if}
{if status='3'}{article id="64"}[uitgevoerd:url]{/article}{/if}
{if status='4'}{article id="64"}[gecancelled:url]{/article}{/if}
b) Referencing by TITLE:
{if status='1'}{article title="instellingen" }[rehearsing:url]{/article}{/if}
{if status='2'}{article title="instellingen"}[uitvoering:url]{/article}{/if}
{if status='3'}{article title="instellingen"}[uitgevoerd:url]{/article}{/if}
{if status='4'}{article title="instellingen"}[gecancelled:url]{/article}{/if}
{/article}
OUTPUT:
{article}
{if status:value='0'}
{article-nested id="[id]"}
{if datum-eerste-uitvoering > date('today') && datum-laatste-uitvoering > date('today') }BOTH IN FUTURE {/if}
{if datum-eerste-uitvoering < date('today') && datum-laatste-uitvoering > date('today') }IN BETWEEN {/if}
{if datum-eerste-uitvoering < date('today') && datum-laatste-uitvoering < date('today') }BOTH IN PAST {/if}
{/article-nested}
{/if}
{/article}
TEST CASES TEXTUAL OUTPUT
A 1. Test with textual-output: case status = 0 ( -> evaluate dates 'datum-eerste-uitvoering' && 'datum-laatste-uitvoering')
{article}
{if status:value='0'}
{article-nested id="[id]"}
{if datum-eerste-uitvoering > date('today') && datum-laatste-uitvoering > date('today') }REHEARSING-date-evaluation{/if}
{if datum-eerste-uitvoering < date('today') && datum-laatste-uitvoering > date('today') }UITVOERING-date-evaluation {/if}
{if datum-eerste-uitvoering < date('today') && datum-laatste-uitvoering < date('today') }UITGEVOERD-date-evaluation {/if}
{/article-nested}
{/if}
{/article}
A 2. Test with textual-output: case status != 0 ( -> evaluate 'set' status =1/2/3/4)
{article}
{if status:value!='0' }
{article-nested id="[id]"}
{if status='1'}REHEARSING-set-status{/if}
{if status='2'}UITVOERING-set-status{/if}
{if status='3'}UITGEVOERD-set-status{/if}
{if status='4'}CANCELLED-set-status{/if}
{/article-nested}
{/if}
{/article}
TEST CASES IMAGE OUTPUT
B 1. Test with IMAGE-output: case status = 0
{article}
{if status:value='0'}
{article-nested id="[id]"}
{if datum-eerste-uitvoering > date('today') && datum-laatste-uitvoering > date('today') }{article id="64"}[rehearsing]{/article}{/if}
{if datum-eerste-uitvoering < date('today') && datum-laatste-uitvoering > date('today') }{article id="64"}[uitvoering]{/if}
{if datum-eerste-uitvoering < date('today') && datum-laatste-uitvoering < date('today') }{article id="64"}[uitgevoerd]{/if}
{/article-nested}
{/if}
{/article}
B 2. Test with IMAGE-output: case status != 0
{article}
{if status:value!='0' }
{article-nested id="[id]"}
{if status='1'}{article id="64"}[rehearsing]{/article}{/if}
{if status='2'}{article id="64"}[uitvoering]{/article}{/if}
{if status='3'}{article id="64"}[uitgevoerd]{/article}{/if}
{if status='4'}{article id="64"}[gecancelled]{/article}{/if}
{/article-nested}
{/if}
{/article}
OUTCOME
See:
sta.vanloon.net/index.php/tst
Or see screen shots:
1. https://imgur.com/CxwOKbY
2. https://imgur.com/DmZR9eJ