webCOMAND

cTemplate Directives

cTemplate directives are instructions that control the flow and output of a cTemplate as it is parsed.

Directives are denoted by a hash symbol (#) immediately followed by a directive name in all upper-case letters.  For example:

#BREAK

Parameters

Most directives receive parameters, so the directive name must be followed by an open parenthesis, then zero or more comma-separated parameters, and a closing parenthesis.  For example:

#CALC(1 + 2)

Depending on the directive, the following types of parameters may be accepted.

Blocks

Some directives apply to a block of text.  In those cases there is a start and end directive.  For example:

#PLAINTEXT
Some text that will not be parsed.
#ENDPLAINTEXT

#FOREACH($array as $item)
${item.Title}
#ENDFOREACH

Directive Groups

cTemplate directives are organized into logical groups below and in the Table of Contents.

Variables

Content

Flow Control

Publishing

Text

Other