Looper Dynamic Content

In this article we're going to explain how to use Looper Dynamic Content.

  1. Current Item
  2. Index (Name)
  3. Index (Number)
  4. Index (Zero)
  5. Total Item Count
  6. Total Pages
  7. Found Posts
  8. Field

Loopers turn your static site into something beautiful, giving you the ability to design multiple pieces at once. You can even make them super.

Looper Dynamic Content

Current Item

This returns the whole item in full. If this is a number or piece of text, it can be used just to output that looped over value. For objects, can view the JSON output of a Looper Object via the following:

{{dc:looper:item type="json"}}

In Twig you can access the object values directly through a . after each object key. For example:

{# Single depth #} {{ looper.item.key }} {# Or multiple objects deep #} {{ looper.item.keyContainingAnObject.key }}

Index (Name)

This returns the index or current count of the current looped item.

When using Loop Keys and looping over an object, Index (Name) will output the key of the property you are currently looped over. For example if you were looping over this JSON:

{ "name": "Auld lange sayne", "lyrics": "Should old acquiantice be forgot, and never brought to mind?" }

Your first item would have name as your Index (Name) value, and lyrics would be the second index.

Index (Number)

This returns the index or current count of the current looped item. The difference is that in the Loop Keys example above, this would display the number no matter what.

Index (Zero)

This returns the index or current count of the current looped item. It is zero index based, which is useful in more advanced integrations and functionality.

Total Item Count

The total number of items you are looping over.

Total Pages

Not always used by a Looper Provider, this displays the number of pages that can be looped over. For example, if you were looping over 30 posts from the Query Builder and you had 90 posts in total, you would have 3 pages in total.

Found Posts

Not always used by a Looper Provider, this displays the total number of items available. It differs from Total Item Count as this will display the total number of items that could have been looped over. Since you can limit the number of items to loop over in a provider like the Query Builder, this will display the true number of items.

Field

If you are looping over an object from an External API Looper or any other Looper, you can use this Dynamic Content to grab a singular value from that object.

See something inaccurate? Let us know