ComboStrap - Template Iterator

About

iterator permits to loop and applies a template in order to create a list of pages.

You may apply the following layout:

Example

Masonry

The below iterator example:

  • will generate the last 4 modified pages (defined by the page sql in the data node)
select order by date_modified desc limit 4

The iterator markup:

<iterator>
    <data>select where is_low_quality = 0 order by date_modified desc limit 4</data>

    <heading d3 text-align="center" spacing="mb-3"> The last 4 Changes </heading>
    <masonry>
        <template>
            <card clickable>
            <page-image path="$path" ratio="16:9"/>
            === $title ===
            <itext color="muted"><date format="%h %d - %H:%M">$date_modified</date></itext>
            
            $description [[$path| ]]
            </card>
        </template>
    </masonry>
</iterator>

The Result:

The last 4 Changes

All variables that can be used in a template text

May 26 - 17:20

This page describes which variables you can use in a template text

ComboStrap Styling - Text Align Attribute

May 24 - 07:35

text-align is a typographic attribute that sets the alignment of the lines of text inside a block component. Syntax where: breakpoint is optional and takes one of the breakpoint values (ie screen size) (only on Bootstrap 5) sm: small md: medium lg: large xl: extra-large the value may be:startcenterendjustifbox componenblock componentcartext componenscreen size

Date Component: display a date in any format you wish

May 23 - 15:51

With the date component, you can print a date in any format (from today's date to page date)

Pipeline

May 10 - 12:56

A pipeline is a element that contains a list of function (called a pipeline) that transforms successively a string. Pipelinetemplate Syntax where: value is the string to transform or a template variable function is one of: - make the first letter of each word a capital letter (ie uppercase letter)capitalizecutseparatorselectorx[-y]x-yheadlengthtailrconcatreplacetrim

Syntax

<iterator>
   <data>select where variable = 'xxx'</data>
   ... header  markup...
   <template>$variable1 ... $variable2</template>
   ... footer  markup...
</iterator>

where:

  • data contains a page sql
  • template is a template that will be repeated for each data row.
  • If your iteration is time-based, you may need to set a page cache expiration frequency.
  • If the data does not return any rows, the iterator content is not printed (ie header and footer included)
Powered by ComboStrap