Search
Other Articles Anywhere questions
Forum

Conditional Handling and Displaying Multiple Custom Field Values from Linked Articles

Alex R's Avatar Alex R
Hi Peter,

Can you take a look at the following syntax:
<p>{article ignore-state="true"}</p>{if privacy-status!="Private" AND case-role="Child"}<h2>Help Find [first-name-missing-case:text]!</h2>
<h3>Call Now with Any Information</h3>
{foreach data="agencies"}<p>
[row:missing-case-organization:text]
[row:missing-case-organization-contact-info:text]
[row:missing-case-contact-organization:text]
<strong>[row:missing-case-contact-phone:text]</strong></p><p>{/foreach}</p><p>{/if}</p>{/article}
<p>{article ignore-state="true"}</p>{if privacy-status!="Private" AND case-role="companion"}<h2>Help Find {articles individuals="this:id" case-role="Child"}{if first} [first-name-missing-case:text] {if last}and [first-name-missing-case:text]{/if}{/articles}!</h2>
<h3>Call Now with Any Information</h3>
{foreach data="agencies"}<p>
[row:missing-case-organization:text]
[row:missing-case-organization-contact-info:text]
[row:missing-case-contact-organization:text]
<strong>[row:missing-case-contact-phone:text]</strong></p><p>{/foreach}</p><p>{/if}</p>{/article}
<p>{article ignore-state="true"}</p>{if privacy-status!="Private" AND case-role="suspect"}<h2>Help Find [first-name-missing-case:text]!</h2>
<h3>Call Now with Any Information</h3>
{foreach data="agencies"}<p>
[row:missing-case-organization:text]
[row:missing-case-organization-contact-info:text]
[row:missing-case-contact-organization:text]
<strong>[row:missing-case-contact-phone:text]</strong></p><p>{/foreach}</p><p>{/if}</p>{/article}
Here is a link where you can see the result (look at the pink box in the side bar)
Confidential information:
(hidden)

(I am using the Regular Labs Articles Field to connect the articles)
The data I am calling from individuals (the articles field) is supposed to output 3 names.
{articles individuals="this:id" case-role="Child"}{if first} [first-name-missing-case:text] {if last}and [first-name-missing-case:text]{/if}{/articles}
It only outputs two names.I aimed to design it in a way that when there are more than two names, it separates the initial series with a comma and adds "and" before the last name. It works in the case of one name or two names, but not when there is 3 or more. Examples:
One Name: Jane
Two Names: Jane and John
More Then Two Names: Jane, John and Jack
More Then Two Names: Jane, John, Pack and Peter

Is what I want feasible? If, yes can you help.

Many Thanks!
Peter van Westen's Avatar Peter van Westen ADMIN
You cannot nest {if} tags.
Also, you now have 2 opening {if} tags and one closing {/if} tag.

Please read:
docs4.regularlabs.com/articlesanywhere/d...-for-multiple-values

You can use:
[first-name-missing-case separator=", " last-separator=" and "]
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription