A page is two files: the PHP that gets the data and the template that shows it. A designer working on the template needs the data, but not the database, the login or the rest of the server behind it. Ask for the page with &padSample and PAD runs no PHP at all - not the page's, nor an _inits.php or _exits.php around it - and takes the variables from _samples/<page>.json in the page's directory instead.

PHP
fragments/samples_1.php
HTML
fragments/samples_1.pad
Result
<?php

$who
= 'the real page';
$orders = [ [ 'number' => 10100, 'total' => 10223.83 ],
[
'number' => 10101, 'total' => 10549.01 ] ];

?>
<p>Orders, as {$who} sees them:</p>
<ul>
{orders}<li>{$number}: {$total}</li>{/orders}
</ul>

Orders, as the real page sees them:

  • 10100: 10223.83
  • 10101: 10549.01

Beside that page lies fragments/_samples/samples_1.json:

{ "who": "a designer", "orders": [ { "number": 1, "total": 9.5 } ] }

so ?fragments/samples_1&padSample shows that order instead - from this machine only, see below.

Capturing a sample

Database tags in the template

A database tag in the template still asks the database, unless it has a name the sample holds: {array "* from orders", name='orders'} reads the sample's orders, and a capture records the database's answer under that name.

Who may ask

Skipping the PHP skips the checks it makes, so $padSample decides: 'local', the default, honours padSample for a request this machine makes to itself; TRUE for everyone - only on a design server without real data behind it; FALSE never. A capture is always local only.