Sequences - Xref - Sequences - loop


App: manual Page: lvl_occ/6
PHP
HTML
lvl_occ/6.pad
Result
<table border='1'>
{sequence 3}
<tr>
{sequence 5}
<td>{echo ($-2 * 10) + $-1}</td>
{/sequence}
</tr>
{/sequence}
</table>

App: manual Page: pages/levels_and_occurrences
PHP
HTML
pages/levels_and_occurrences.pad
Result
<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>

App: regression/errors Page: syntax/a_play_build_strategy_must_be_one_the_type_has
PHP
HTML
syntax/a_play_build_strategy_must_be_one_the_type_has.pad
Result
{sequence 5, push='s'}{pull:s make, prime, build='fixed'}{$sequence} {/pull:s}

App: regression/errors Page: syntax/a_resume_prefix_is_no_type
PHP
HTML
syntax/a_resume_prefix_is_no_type.pad
Result
{sequence 5, push='x'}{resume:x add=1}

App: regression/framework Page: data/a_bare_count_is_a_sequence_of_that_many
PHP
HTML
data/a_bare_count_is_a_sequence_of_that_many.pad
Result
{sequence 3}x{/sequence}

App: regression/framework Page: data/and_it_numbers_them_from_one_when_given_a_name
PHP
HTML
data/and_it_numbers_them_from_one_when_given_a_name.pad
Result
{sequence 3, name='n'}
{$n},
{/sequence}

App: regression/framework Page: lenient/a_bare_pull_with_nothing_pushed_pulls_nothing
PHP
lenient/a_bare_pull_with_nothing_pushed_pulls_nothing.php
HTML
lenient/a_bare_pull_with_nothing_pushed_pulls_nothing.pad
Result
<?php

// The lenient walk under test: with the syntax check off, what cannot run passes the
// value through or yields empty, and the walk carries on.

$padCheckSyntax = FALSE;

?>
[{pull}{$sequence}@else@none{/pull}]

App: regression/framework Page: lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone
PHP
lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone.php
HTML
lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone.pad
Result
<?php

// The lenient walk under test: with the syntax check off, what cannot run passes the
// value through or yields empty, and the walk carries on.

$padCheckSyntax = FALSE;

?>
[{sequence 5, push='x'}{resume:x add=1}][{pull:x}{$sequence} {/pull:x}]

App: regression/framework Page: lenient/a_sequence_parameter_that_is_no_number_takes_its_default
PHP
lenient/a_sequence_parameter_that_is_no_number_takes_its_default.php
HTML
lenient/a_sequence_parameter_that_is_no_number_takes_its_default.pad
Result
<?php

// The lenient walk under test: with the syntax check off, what cannot run passes the
// value through or yields empty, and the walk carries on.

$padCheckSyntax = FALSE;

?>
[{sequence '1;2;3', from='abc'}{$sequence} {/sequence}][{sequence 3, increment='x'}{$sequence} {/sequence}][{sequence 3, skip='x'}{$sequence} {/sequence}][{sequence 3, minimal='x'}{$sequence} {/sequence}][{sequence prime, to='x', rows=3}{$sequence} {/sequence}]

App: regression/framework Page: sequence/a_bare_number_asks_for_that_many_rows
PHP
HTML
sequence/a_bare_number_asks_for_that_many_rows.pad
Result
{sequence 4}
{$sequence},
{/sequence}

App: regression/framework Page: sequence/a_count_of_zero_gives_no_rows
PHP
sequence/a_count_of_zero_gives_no_rows.php
HTML
sequence/a_count_of_zero_gives_no_rows.pad
Result
<?php

$n
= 0;
$m = 3;

?>
[{sequence $n}{$sequence} {/sequence}][{sequence prime, rows=0}{$sequence} {/sequence}][{loop0}x{/loop}][{sequence $m}{$sequence} {/sequence}]

App: regression/framework Page: sequence/a_count_or_range_is_read_wherever_the_options_stand
PHP
HTML
sequence/a_count_or_range_is_read_wherever_the_options_stand.pad
Result
[{sequence name='i', 5}{$i} {/sequence}][{sequence rows=2, '1..4'}{$sequence} {/sequence}][{sequence ';5;6'}{$sequence} {/sequence}][{sequence 5, name='i'}{$i}{/sequence}][{sequence rows=3}{$sequence}{/sequence}]

App: regression/framework Page: sequence/a_first_parameter_an_action_does_not_take_is_the_store_the_type_or_the_count_it_names
PHP
HTML
sequence/a_first_parameter_an_action_does_not_take_is_the_store_the_type_or_the_count_it_names.pad
Result
{sequence '11..16', push='nums'/}[{reverse 'prime'}{$sequence} {/reverse}][{action:first 'prime'}{$sequence} {/action:first}][{action:splice 'nums', splice=2}{$sequence} {/action:splice}][{append 5}{$sequence} {/append}][{action:sort 'nums'}{$sequence} {/action:sort}][{action:shift 'nums', shift=2}{$sequence} {/action:shift}]

App: regression/framework Page: sequence/a_generated_run_past_the_lucky_numbers_ends_quietly
PHP
HTML
sequence/a_generated_run_past_the_lucky_numbers_ends_quietly.pad
Result
[{sequence lucky, from=1999990, rows=3}{$sequence} @else@none{/sequence}][{sequence from=1999999, rows=3, flag='lucky'}{$sequence}{/sequence}]

App: regression/framework Page: sequence/a_list_the_request_or_a_row_brings_under_a_store_name_leaves_the_store_to_the_sequence
PHP
sequence/a_list_the_request_or_a_row_brings_under_a_store_name_leaves_the_store_to_the_sequence.php
HTML
sequence/a_list_the_request_or_a_row_brings_under_a_store_name_leaves_the_store_to_the_sequence.pad
Result
<?php

// The visitor sends ?primes[]=1&orders[]=7 - lists, under the names of the stores the page
// pushes and names - which become variables as every request value does. They are no array
// the page made: the stores are kept as without them, where the first ended the page on
// "the store name 'primes' is already an array of the page" and the second kept no store.

$_GET ['primes'] = [ '1' ];
$_GET ['orders'] = [ '7' ];

padGetParms ( 'GET', [ 'primes' => [ '1' ], 'orders' => [ '7' ] ] );

?>
[{sequence '1..3', push='primes'/}{pull:primes}{$primes} {/pull:primes}]
[{sequence 3, name='orders'}{$orders}{/sequence}|{pull:orders}{$orders}{/pull:orders}]
{data 'o'}[{"id":1,"kids":[{"k":1}]}]{/data}[{o}{sequence '1..2', push='kids'/}{pull:kids}{$kids}{/pull:kids}{/o}]