PAD - PHP Application Driver


home | manual | reference | regression | sequence | develop | apps


Pages/walking

PHP
HTML
pages/walking.pad
Result
{block}
<p>
Normally all the occurences for a level are retrieved and placed in an internal table before
the processing takes place.<br>
When this table is processed PAD knows for example when it is handling the last Occurence.<br>
The below example with the {tag 'sequence'} tag does do that:
</p>
{/block}

{page 'walk/1'}

{block}
<p>
But some PAD tags use the PAD construct 'walking', then the occurences are processed one by one.<br>
The tags {tag 'while'} &amp; {tag 'until'} are an example of this.<br>
This 'walking' construct breaks those special pad tags like {tag 'last'} & {tag 'border'} that give information about a {tag 'tag'}<br>
Also the 'Data Handling' options are broken since those work on the all occurences at once.
</p>
{/block}

{page 'walk/2'}

{block}
<p>
To solve above breaking, place the result of a walking tag into the Data Store, and use it as a own tag.
</p>
{/block}

{page 'walk/3'}

{fragment 'walk/_lib/lib'}

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}




home | manual | reference | regression | sequence | develop | apps

(c) 2003-2025 Herbert Groot Jebbink