|
Normally all the occurences for a level are retrieved and placed in an internal table before the processing takes place.
When this table is processed PAD knows for example when it is handling the last Occurence.
The below example with the {sequence} tag does do that:
|
|
HTML
|
RESULT
|
{myTable}
{sequence '1..5'}
<tr> <td> {first} X {/first} </td> <td> {middle} X {/middle} </td> <td> {last} X {/last} </td> <td> {border} X {/border} </td> </tr>
{/sequence}
{/myTable}
|
|
first
|
middle
|
last
|
border
|
|
X
|
|
|
X
|
|
X
|
|
|
|
X
|
|
|
|
X
|
|
|
|
|
X
|
X
|
|
|
But some PAD tags use the PAD construct 'walking', then the occurences are processed one by one.
The tags {while} & {until} are an example of this.
This 'walking' construct breaks those special pad tags like {last} & {border} that give information about a {tag}
Also the 'Data Handling' options are broken since those work on the all occurences at once.
|
|
HTML
|
RESULT
|
{myTable}
{set $loop = 1}
{while $loop LE 5}
<tr> <td> {first} X {/first} </td> <td> {middle} X {/middle} </td> <td> {last} X {/last} </td> <td> {border} X {/border} </td> </tr>
{increment $loop}
{/while}
{/myTable}
|
|
first
|
middle
|
last
|
border
|
|
X
|
|
X
|
X
|
|
|
X
|
X
|
|
|
X
|
X
|
|
|
X
|
X
|
|
|
X
|
X
|
|
|
To solve above breaking, place the result of a walking tag into the Data Store, and use it as a own tag.
|
|
HTML
|
RESULT
|
{set $loop = 1}
{while $loop LE 5, toData='abc'} {increment $loop} {/while}
|
|
{myTable}
{abc} <tr> <td> {first} X {/first} </td> <td> {middle} X {/middle} </td> <td> {last} X {/last} </td> <td> {border} X {/border} </td> </tr> {/abc}
{/myTable}
|
|
first
|
middle
|
last
|
border
|
|
X
|
|
|
X
|
|
X
|
|
|
|
X
|
|
|
|
X
|
|
|
|
|
X
|
X
|
|
This manual page uses below PAD fragment.
{content 'myTable'}
<table border=1>
<tr> <th> first </th> <th> middle </th> <th> last </th> <th> border </th> </tr>
@content@
</table>
{/content}
|
|