{{each}}
expression. limit
. This example shows how to retrieve only the 5 latest blog posts from a content set called Posts.asc
, by default. To sort in descending order you must specify descending (Z-A or 9-0) which is coded asdesc
.group
group
. In other words, using group
will return items based on how many unique items are listed in a field.
For example, if you had a list of products, but only wanted to print out items with unique barcodes, you could group your products by barcode, shown in the example below. If there are duplicates, only the most recent entry will be outputted.like
like
to find similar items. The code below shows an example of the syntax being used to search through a content set called Events where the event's zip code that matches a get variable in the URL. For example if your URL is http://mysite.com/location-search/?zip_search=92101
the get_var
is named zip_search
and its value is 92101
.where
to your resultswhere
statement in the each loop essentially helps you filter the data you're looking through to target the exact pieces of data that you're looking to return. The following example shows how to use a where
statement to narrow down your results to a 3 month date range. The below code is looping through a content set called Events and looking for items where the event's date is greater than now at an interval of 3 months.