Application Structure
An application is a directory under apps/, and a page is a pair of files in it: name.php gathers the data, name.pad renders it - the php and html page is about that pairing. No routing and no controllers: creating the files creates the page, and subdirectories become url paths - ?admin/users is admin/users.pad.
The wrappers
A file _inits.pad wraps every page of its directory: the page's own output lands where the wrapper writes @page@, and an _exits.pad closes below it. This very page is inside one - the menu at the side and the bar with the title above what you are reading come from the wrapper of the manual, which opens the frame every PAD application shares and closes it again below the page:
{common:padFrame}
@page@
{common:padFrameEnd}
Wrappers nest: the application's own _inits.pad wraps the subdirectory's, which wraps the page. The page never mentions any of them.
The PHP runs first, in order
All PHP has run before any template renders. Down the directory chain and back up:
/_inits.php
/admin/_inits.php
/admin/users.php
/admin/_exits.php
/_exits.php
Subdirectories inherit, and may override
The extension directories work at every level. _lib/ files accumulate down the chain, so a deeper page has every level's functions; the lookup for a tag, function or snippet starts in the page's own directory and walks up, so a subdirectory may bring its own words - or redefine an inherited name, and its version wins for its pages.
The structure application is this page live: a tree three levels deep: the root carries the full set of special directories, every level its own wrappers, and each level below overrides one or two names and inherits the rest, with pages that show which level answered.