Click here to ask a question or provide feedback on this topic Bookmark this topic Print this topic     Next

Using iterators

Iterators are loop constructs that walk through a folder and its subfolder and pick up every document found. They can be compared to For each x in SomeContainer do  

Iterators can be used for creating:

  • Blogs
  • Documentation sets (TOC)
  • News flashs
  • Photo albums

Syntax

{%ITERATOR [ATTRIBUTES]%}CODE_TO_DUPLICATE{% /ITERATOR%} 

CODE_TO_DUPLICATE can contain the following iterator variables: {%ID%}, {%NAME%}, {%PATH%}, {%TITLE%}, {%SUMMARY%}, {%BODY%}, {%URL%} {%CREATED_DATE%} and {%MODIFIED_DATE%}

Attribute syntax and description

Please note that all values are used in a case-insensitive way.

Attribute name Syntax Description
DISPLAY

BULLETS, NUMBERS, COMMASEPARATED, TABLE

BULLETS: The Iterator wil show a bulletted list.
NUMBERS: The Iterator wil show a numbered list.
COMMASEPARATED: The iterator will show a comma-separated list.
TABLE: The Iterator will show a table.

TYPE

SEARCH, TOC, SUBDIRS, FILES.

SEARCH: Will list all folders that contain a document with the specified filename, the filename has to be an exact match.
TOC: Will list all the documents in the specified folder, optionally including documents in subdirectories.
SUBDIRS: Will list all the folders in the specified folder, optionally including folders in subdirectories.
FILES: Will list all the files in the specified folder, optionally including files in subdirectories.

NAME Normal name, should start with a character, only characters and digits. Default value: "". Specifies the name of the iterator. If set, then the variables have to be qualified with the iterator's name. Example: {%IteratorName.url%}
REGEX Perl 5-compatible. This RegEx is matched to the Name of the item. For syntax, see Microsoft's documentation. Default Value: "". Specifies a filter of what elements to show.
INCLUDESUBDIRS "True" or "False". Default value: FALSE.

Specifies whether or not to descend into subdirectories.
(Ignored when TYPE=SEARCH)

INCLUDESELF "True" or "False". Default value: FALSE. Specifies whether or not to include the item containing the iterator. (Ignored when TYPE=SEARCH or TYPE=SUBDIRS)
BASEDIR

Root: "/"
Some directory: "/ParentDirectory/ChildDirectory" (the first slash is mandatory here)
Default value: "".

Specifies which directory to iterate from. Empty means the directory containing the document containing the iterator.
FILENAME The name of the file. Like: "Features". Default value: "". Specifies which filename to search for. (With TYPE=SEARCH only)
MAXITEMS Any numeric value. Like, "1", "3", "45". Default value: 0, meaning no limit. The iterator will return the first [n] documents only. This is useful if you want to show the newest items only for example.
ITEMSPERPAGE Any numeric value. Like, "1", "3", "45". Default value: 0, meaning no limit. Same as [MAXITEMS], plus paging. IWS will render multiple documents (pages) if more items than ItemsPerPage exist. See Paging and Navigation for more information.
REVERSE "True" or "False". Default value: FALSE. Applicable items will be iterated in reverse order.
RANDOM "True" or "False". Default value: FALSE. Applicable items will be iterated in random order.

Examples

The list of examples below is created by using this interator: {%ITERATOR BASEDIR=%}

{%TITLE%}

{%SUMMARY%}

Example 1

Example of how to list all documents in the current directory

Example 2

Using advanced iterators to have more control over the output



Feedback? Bookmark this topic     Next

We use the ABCpdf .NET PDF component for HTML to PDF conversion...