Live reload

With $padReload = 'local' in an application's _config/config.php, every page of a local request carries a small script that asks the server once a second whether a file behind the page has changed - and reloads the page when one has. Save a template, a page's PHP or a stylesheet, and the browser shows it.

<?php

  // _config/config.php
  $padReload = 'local';

?>

What it watches

The script asks ?page&padReload, which the engine answers with the newest file time before it runs any page. Together with pad serve (see Pad command) no other tool is needed.

Where it never goes

Only a local request gets it - the command line, or this machine asking itself with nothing forwarded - whatever the setting. It is left out of a bare fragment (&padInclude), of anything that is not an HTML page answering 200, of the page cache, which stores the page before the script is added, and of a pad export. Set it in the configuration rather than in a page's PHP: the poll is answered before any page runs.