Introduction to File Loops

CodeGen

Introduction to File Loops

 

A file loop is a template file construct which allows you to iterate through the collection of files that are assigned to the structure which is currently being processed.

File loops are delimited by a matching pair of <FILE_LOOP> and </FILE_LOOP> tags, which surround the template code to be inserted for each file. The code between the opening and closing tags of a file loop is repeated for each file assigned to the structure being processed. This code may contain other generic and structure tokens, and may also contain special file loop tokens, which are discussed later. Loop utility tokens can also be used in file loops. File loop tokens can only be used inside a file loop, and a file loop can’t be declared within any other loop construct.

There are two types of file loops, called multi-line file loops, and in-line file loops.

Multi-Line File Loops

Multi-line file loops occur when the opening and closing file loop tags appear on separate lines in a template file, and delimit one or more entire lines of template code, like this:

[code]

<FILE_LOOP>code
</FILE_LOOP>

[code]

Multi-line file loops generate one or more lines of output code for each file that is processed.

In-Line File Loops

In-line file loops exist when the opening and closing file loop tags appear on the same line in a template file, and delimit part of a line of template code, like this:

[code] <FILE_LOOP> code </FILE_LOOP> [code]

In-line file loops generate code into the current output line.

 

 

 


Copyright © 2012  Synergex International, Inc.