• Resolved norte2017

    (@norte2017)


    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    There is no indication in our docs that you can annul an if condition based on another one. Your template as you’ve shirk it would output any author you’ve place in each of those fields. You should probably look at relationships to authors based on the structure you’re discussing.

    You should check out:

    Plugin Contributor Jim True

    (@jimtrue)

    Any kind of extremely complicated inter conditions would require PHP. You can’t expect an easy builder to do everything that PHP can.

    Thread Starter norte2017

    (@norte2017)

    Hi,
    thanks for your comments.

    It’s done using only the pod fields, the “if” tag and hmtl.
    As I’m not a developer, null on php, I thought about the problem using a logic approach.
    No php was required after all to generate the correct citation.
    Just added a pod field that acts as a filter which tells the template the right “if” condition to output, thus annulling all the invalid conditions.
    Works perfectly as I’ve expected.
    However, I think that I may still improve this filter field.

    At the end, have some expectations on what pods can do is a good bet.
    Congratulations for your great work and support.

    Best regards.

    Rogerio

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hierarchic conditions using the “if” tag’ is closed to new replies.