Hierarchic conditions using the “if” tag
-
Hi,
I’m building a template to show a publication citation style. Book citations may include one author, 2 authors or more.
If only one author to show, the “if” tag works.
But if the condition is to have 2 authors, this condition should annul the first condition of one author only.
If the condition is to have 3 authors, this one should annul the first two.
I tried to use the following code:<p><font color=”#93CCF9″>Harvard Style:</font></p>
<p>
[if 1st_author_last_name]
{@1st_author_last_name}, {@1st_author_capital_first_name} ({@publication_year}). <i>{@book_title}</i>. {@publisher_city}: {@publisher}.
[/if][if 2nd_author_last_name]
{@1st_author_last_name}, {@1st_author_capital_first_name} & {@2nd_author_last_name}, {@2nd_author_capital_first_name} ({@publication_year}). <i>{@book_title}</i>. {@publisher_city}: {@publisher}.
[/if][if 3rd_author_last_name]
{@1st_author_last_name}, {@1st_author_capital_first_name}; {@2nd_author_last_name}, {@2nd_author_capital_first_name} & {@3rd_author_last_name}, {@3rd_author_capital_first_name} ({@publication_year}). <i>{@book_title}</i>. {@publisher_city}: {@publisher}.
[/if]
</p>As I’ve expected it didn’t work as desired, because all valid conditions were outputted, i.e. three different citations (two incomplete and one complete).
This means the following: if there is a second or a third authors, the prior conditions will be also valid and the template will output two or three different citations, which only the last fulfilled condition would be the right one to appear.
My question:
Is there any way to deal with hierarchical conditions using pods template tags or a way to wrap all these conditions using the “if” tag so the template would output only the last fulfilled condition and not showing the first one(s)?
Thank you for your attention.
Best regards.
Rogerio
- The topic ‘Hierarchic conditions using the “if” tag’ is closed to new replies.