Integration Server 10.3 | Dynamic Server Pages and Output Templates Developer's Guide | Using Dynamic Server Pages (DSPs) | Using the DSP Tags | Begin...End Constructs
 
Begin...End Constructs
Many DSP tags have both beginning and ending elements. When you use the %loop% tag, for example, you enclose the code over which you want the DSP Processor to iterate, within a %loop%…%end% construct.
To make your DSP easier to read, you can append a suffix to the %end% element of any construct to visually associate it with its beginning element. For example, in the following DSP, the %end% element of the %loop% construct is named %endloop% and the %end% element for the %ifvar% construct is named %endifvar%.
.
.
.
%ifvar orders%
%loop orders%
<p>Date: %value orderDate%PO Number: %value orderNum%</p>
%endloop%
%endifvar%
.
.
.
Be aware that only the first three characters of an %end% element are significant. The DSP Processor ignores any suffixes that you add and simply associates an %end% element with the most recent beginning element (in other words, the %end% element always ends the current construct). This means that you can nest one construct within another (as shown above), but you cannot overlap them.
For example, you cannot use the %comment%…%endcomment% construct to “remark out” an %endloop% element as shown in the following sample. Because the DSP Processor ignores suffixes, the first %endloop% tag would end the comment block, and the %endcomment% tag would end the loop.
.
.
.
%ifvar orders%
%loop orders%
<p>Date: %value orderDate% PO Number: %value orderNum%</p>
%comment%
<p>Buyer: %value orderDate% PO Number: %value orderNum%</p>
%endloop%
%endcomment%
<p><b>Shipping Details:</b></p>
<p>Date Shipped: %value shipDate%<br>
Carrier: %value carrier% %value serviceLevel%<br>
======================================================</p>
%endloop%
%endifvar%
.
.
.