App: manual Page: fragments/page_4
PHP
|
HTML
fragments/page_4.pad
|
Result
|
|
{data 'fruit'}["apple","pear"]{/data} <p>A clean pass sees the store: {code clean}{fruit}{$fruit} {/fruit}{/code}</p> {code}{sequence '7;8;9', push='nums'/}{/code} <p>A plain pass pushed nums, and it survived: {pull:nums}{$sequence} {/pull:nums}</p>
|
|
App: manual Page: pages/page
PHP
|
HTML
pages/page.pad
|
Result
|
|
{meta title='Nested Passes - {code} and {page}'}
<p>A nested pass is the engine run inside itself: the content of a <code>{code}</code> pair, or the page a <code>{page}</code> tag names, is rendered as a complete PAD run of its own, and what it produced lands in the surrounding page. The pass sees the request it runs in - its variables, its stores - unless it asks for isolation.</p>
<h2>A pass and what it leaves behind</h2>
<p>A plain <code>{code}</code> shares everything. What the pass creates is still there when it returns:</p>
{example 'fragments/page_1'}
<h2>The four isolation forms</h2>
<p>Three options decide how much of the request a pass sees, and how much of the pass the request keeps. They differ on both sides of the boundary:</p>
<table border="1" cellpadding="8" cellspacing="0" style="border-collapse: collapse;"> <tr><th>form</th><th>sees the outer state</th><th>what it created afterwards</th></tr> <tr><td><code>{code}</code></td> <td>yes</td><td>still there</td></tr> <tr><td><code>{code reset}</code></td> <td>no - a blank slate going in</td><td>still there</td></tr> <tr><td><code>{code clean}</code></td> <td>yes</td><td>taken back out</td></tr> <tr><td><code>{code sandbox}</code></td> <td>no</td><td>taken back out</td></tr> </table>
<p> </p>
{example 'fragments/page_2'}
<h2>Another page as a pass</h2>
<p><code>{page 'name'}</code> runs that page - its .php and its .pad - as a pass, with the same isolation options. A <code>function</code> option runs the pass inside a PHP function body, but it still starts from the caller's variables and what it sets comes back out - a page whose .php half must not touch the caller's variables wants <code>clean</code> or <code>sandbox</code>:</p>
{example 'fragments/page_3'}
<h2>Stores cross the boundary by the same rules</h2>
<p>The data, content, bool and sequence stores follow the isolation form. A <code>clean</code> pass reads the request's stores; a <code>sandbox</code> or <code>reset</code> pass starts without them. On the way out, only a plain pass's pushes stay: each of the three isolated forms puts the request's stores back exactly as they were, its own pushes included:</p>
{example 'fragments/page_4'}
<h2>Engine state is always put back</h2>
<p>Whatever the isolation form, the engine itself returns to where it was: a loop the pass ran inside continues from the same row, and a request-lived counter such as <code>{switch}</code>'s rotation is rolled back with the rest - a pass takes its counting with it:</p>
{example 'fragments/page_5'}
<p>Both calls answer the first value: the rotation the pass advanced was restored when the pass returned.</p>
|
|
App: regression/errors Page: eval/a_name_nothing_reads_beside_a_store_pulled_is_named
PHP
|
HTML
eval/a_name_nothing_reads_beside_a_store_pulled_is_named.pad
|
Result
|
|
{sequence '1..3', push='s'/}{pull:s reverse, 'abc'}{$s} {/pull:s}
|
|
App: regression/errors Page: eval/a_second_store_beside_the_store_pulled_is_named_as_one
PHP
|
HTML
eval/a_second_store_beside_the_store_pulled_is_named_as_one.pad
|
Result
|
|
{sequence '1..6', push='a'/}{sequence '1..3', push='b'/}{a:sum 'b'}{$sequence} {/a:sum}
|
|
App: regression/errors Page: eval/a_stored_term_that_is_no_number_is_named_as_the_parameter
PHP
|
HTML
eval/a_stored_term_that_is_no_number_is_named_as_the_parameter.pad
|
Result
|
|
{sequence '2;b;3', push='s'}{/sequence}{sequence add='s', rows=3}{$sequence} {/sequence}
|
|
App: regression/errors Page: eval/an_unknown_action_given_to_action_is_named
PHP
|
HTML
eval/an_unknown_action_given_to_action_is_named.pad
|
Result
|
|
{sequence '1..5', push='s'/}[{action s, action='nope'}{$sequence} {/action}]
|
|
App: regression/errors Page: eval/resume_in_another_case_is_no_tag
PHP
|
HTML
eval/resume_in_another_case_is_no_tag.pad
|
Result
|
|
{sequence '1..3', push='s'/}{Resume reverse}
|
|
App: regression/errors Page: eval/resume_names_a_parameter_past_the_first_that_nothing_reads
PHP
|
HTML
eval/resume_names_a_parameter_past_the_first_that_nothing_reads.pad
|
Result
|
|
{sequence '1..5', push='s'/}{resume 'reverse', 'x'}
|
|
App: regression/errors Page: eval/resume_of_a_quoted_store_that_is_not_there_is_named
PHP
|
HTML
eval/resume_of_a_quoted_store_that_is_not_there_is_named.pad
|
Result
|
|
{sequence '1..5', push='s'/}{resume 'typo', reverse}{pull:s}{$s} {/pull:s}
|
|
App: regression/errors Page: eval/resume_of_a_store_that_is_not_there_is_named
PHP
|
HTML
eval/resume_of_a_store_that_is_not_there_is_named.pad
|
Result
|
|
{sequence '1..5', push='s'/}{sequence '1..3', push='t'/}{resume pull='typo', reverse}{pull:t}{$t} {/pull:t}
|
|
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/errors Page: syntax/a_slice_or_splice_position_that_is_no_whole_number_is_named
PHP
|
HTML
syntax/a_slice_or_splice_position_that_is_no_whole_number_is_named.pad
|
Result
|
|
{sequence '2..4', push='st'}{sequence '1..6', slice='st'}{$sequence} {/sequence}
|
|
App: regression/framework Page: expressions/pull_reads_a_stored_sequence
PHP
|
HTML
expressions/pull_reads_a_stored_sequence.pad
|
Result
|
|
{sequence '1..3', push='p'/} {echo '' | pull:p . pull:p}
|
|
App: regression/framework Page: expressions/sequences_searches_the_store_an_array_path_so_the_index_counts_from_0_where_sequ
PHP
|
HTML
expressions/sequences_searches_the_store_an_array_path_so_the_index_counts_from_0_where_sequ.pad
|
Result
|
|
{sequence '1..5', push='caseSeq'/} {echo $caseSeq.3@sequences}
|
|
|