|
<p> {block} PAD is data driven, the PAD data concepts are named Level and Occurence <br><br> Below example: <br> - Is two levels deep <br> - The level 'row' has 3 occurences<br> - The level 'column' has 5 occurences<br><br> {/block} {example 'lvl_occ/1', skipNames, center} </p>
{block} If not specifield for a PAD tag then default it has 1 occurence. <br><br><hr><br> Just for fun, below the above example implemented in a few different ways. <br> Hopefully all this magic will be explained in this manual. {/block}
<p> {sequence '2..12', name='xxx'} {example 'lvl_occ/{$xxx}', skipNames{notFirst},skipOpen,skipHeader{/notFirst}{notLast},skipClose{/notLast}} {/sequence} </p>
|
PAD is data driven, the PAD data concepts are named Level and Occurence
Below example:
- Is two levels deep
- The level 'row' has 3 occurences
- The level 'column' has 5 occurences
|
|
PHP
|
HTML
|
Result
|
<?php
$row [1] ['column'] [1] ['cell'] = 11; $row [1] ['column'] [2] ['cell'] = 12; $row [1] ['column'] [3] ['cell'] = 13; $row [1] ['column'] [4] ['cell'] = 14; $row [1] ['column'] [5] ['cell'] = 15;
$row [2] ['column'] [1] ['cell'] = 21; $row [2] ['column'] [2] ['cell'] = 22; $row [2] ['column'] [3] ['cell'] = 23; $row [2] ['column'] [4] ['cell'] = 24; $row [2] ['column'] [5] ['cell'] = 25;
$row [3] ['column'] [1] ['cell'] = 31; $row [3] ['column'] [2] ['cell'] = 32; $row [3] ['column'] [3] ['cell'] = 33; $row [3] ['column'] [4] ['cell'] = 34; $row [3] ['column'] [5] ['cell'] = 35;
?> |
<table border='1'> {row} <tr> {column} <td>{$cell}</td> {/column} </tr> {/row} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
If not specifield for a PAD tag then default it has 1 occurence.
Just for fun, below the above example implemented in a few different ways.
Hopefully all this magic will be explained in this manual.
|
|
PHP
|
HTML
|
Result
|
<?php
$row = [1,2,3]; $column = [1,2,3,4,5];
?> |
<table border='1'> {row} <tr> {column} <td>{$row | * 10 | + $column}</td> {/column} </tr> {/row} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
<?php
$short = [ [ 11,12,13,14,15 ], [ 21,22,23,24,25 ], [ 31,32,33,34,35 ] ];
?> |
<table border='1'> {short} <tr> {short} <td>{$short}</td> {/short} </tr> {/short} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
<?php
for ($row = 1; $row <= 3; $row++) for ($col = 1; $col <= 5; $col++) $rows [$row] ['cols'] [$col] = TRUE;
?> |
<table border='1'> {rows} <tr> {cols} <td>{echo (&rows:key*10) + &cols:key}</td> {/cols} </tr> {/rows} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
<table border='1'> {sequence '10..30', increment=10, name='row'} <tr> {sequence '1..5', name='column'} <td>{$row | + $column}</td> {/sequence} </tr> {/sequence} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
<table border='1'> {sequence 3} <tr> {sequence 5} <td>{echo ($-2 * 10) + $-1}</td> {/sequence} </tr> {/sequence} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
<table border='1'> {set $row = 10} {while $row <= 30} <tr> {set $column = 1} {while $column <= 5} <td>{echo $row + $column}</td> {increment $column} {/while} </tr> {set $row = $row + 10} {/while} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
{data 'row' } (1,2,3) {/data} {data 'column'} (1,2,3,4,5) {/data}
<table border='1'> {row} <tr> {column} <td>{$row | * 10 | + $column}</td> {/column} </tr> {/row} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
25 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
{data 'myJson'} [ { "column": [ 11, 12, 13, 14, 15 ] }, { "column": [ 21, 22, 23, 24, 35 ] }, { "column": [ 31, 32, 33, 34, 35 ] } ] {/data}
{pad data='myJson'} <table border='1'> @start@ <tr> {column} <td>{$column}</td> {/column} </tr> @end@ </table> {/pad}
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
35 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
{data 'myCsv'} AA,BB,CC,DD,EE 11,12,13,14,15 21,22,23,24,35 31,32,33,34,35 {/data}
<table border='1'> {myCsv} <tr> {fields} <td>{$value}</td> {/fields} </tr> {/myCsv} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
35 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
{data 'myYaml', 'http://localhost/pad/level_demo.yaml'}
<table border='1'> {myYaml} <tr> {column} <td>{$column}</td> {/column} </tr> {/myYaml} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
35 |
| 31 |
32 |
33 |
34 |
35 |
|
| |
{data 'myXml', 'level_demo.xml'}
<table border='1'> {myXml} <tr> {column} <td>{$column}</td> {/column} </tr> {/myXml} </table>
|
| 11 |
12 |
13 |
14 |
15 |
| 21 |
22 |
23 |
24 |
35 |
| 31 |
32 |
33 |
34 |
35 |
|
|