Program flow

This page outlines the basic program flow, i.e. what happens behind the scenes when a visitor enters a site running Wireframe.

  1. User requests an URL belonging to a Page on the site.
  2. ProcessWire figures out the basic requirements to fulfil the request: which page it is for, which template to use, which template file to use, etc.
  3. When the Alternate Template Filename points to the Wireframe bootstrap file (wireframe.php in the /site/templates/ directory) Wireframe gets bootstrapped and initiated (configured).
  4. First Wireframe checks for redirects: if a matching redirect rule is found, user is redirected to the target location instead of the Page getting rendered.
  5. If no redirect was found, View component gets initialized with default parameters: layout, view script, object ontaining partial paths, data arguments, and placeholders. $view API variable is set to refer to the View object.
  6. Wireframe looks for a Controller class for the template of the Page being rendered, and if one is found, it gets instantiated. The constructor method of the Controller automatically sets the Controller up and calls its init() method.
  7. Wireframe chooses a view script for the View component. Unless the view script is "default", the PageRenderNoCache Session variable is set to avoid accidentally caching the output of a temporary (or alternative) view script as the main content of the page. Rules for choosing the view script: a) By default a view script called "default" is used. b) If allow_get_view configuration setting has been enabled, GET parameters can be used to set the view script, but only to the extent allowed by said configuration setting. c) If view script has been set programmatically (in Controller or a hook) this value is used.
  8. Bootstrap file calls the render() method of Wireframe, which renders the Page using the Layout and view script set for the View component, and outputs the resulting markup.

The contents of Controllers, layouts, partials, and views are already entirely up to you as the developer of the site. If you need to modify the program flow as well, you can do that by hooking into various points described above. The easiest way to find which methods are hookable is searching for "___" (three underscores) in the source code of Wireframe.

Back to top