Overriding variables

Dan Rey Oquindo's Avatar

Dan Rey Oquindo

07 Feb, 2018 03:13 AM

Hi,

We need to display something like this

LOOP MEMBERS
  if has_membership_related_items?
     <h1> "Membership Fees"
     loop membership_related_items

  if has_event_related_items?
   <h1> "Event Fees
   loop event_related_items

can you please help on how to achieve such... Or point me to the correct documentation.. Thanks

  1. Support Staff 1 Posted by Scott Tadman on 07 Feb, 2018 04:52 PM

    Scott Tadman's Avatar

    You can create repeated sections with the {{:x}}...{{/x}} notation where that
    references a subsection of your data, and conditionals with {{?x}}...{{/x}}.

    It's easier to demonstrate:

    {{?membership_related_items}}
      <h1> "Membership Fees"
      {{:membership_related_items}}
        <p>{{item1}}</p>
        <p>{{item2}}</p>
      {{/membership_related_items}}
    {{/membership_related_items}}
    

    This depends on having a particular JSON structure, one that looks like:

    {
      "other_variable": "x",
      "membership_related_items": [
        {
          "item1": "valueA",
          "item2": "valueB"
        },
        {
          "item1": "valueC",
          "item2": "valueD"
        }
      ]
    }
    

    Where so long as the membership_related_items key is present the {{?}}
    section will trigger, and within that it will iterate over the elements
    in that array, rendering out each section repeatedly.

    Let me know if that works for you, and if you have any trouble I'll do what I can to help.

Discussions are closed to public comments.
If you need help with PostageApp please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

22 Sep, 2018 08:36 AM
18 Sep, 2018 08:05 PM
28 Aug, 2018 11:21 PM
11 Jun, 2018 11:21 AM
14 May, 2018 05:57 PM