Program flow

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

Here's what happens when a user requests your site that is running on the Wireframe framework:

  1. When user requests an URL, ProcessWire figures out the basic requirements to fulfil the request: which page is it for, which template to use, which template file to use, etc. If "Alternate Template Filename" of the template in question points to Wireframe's bootstrap file (typically /site/templates/wireframe.php), Wireframe gets bootstrapped and initialized (configured).
  2. After booting up, Wireframe automatically checks for redirects (see configuration settings for more details). If a matching redirect rule is found, user is redirected right away, and the Wireframe execution flow is halted.
  3. If there were no matching redirect rules, the View component gets initialized, and the $view API variable is set to refer to this particular View object.
  4. Wireframe attempts to find a Controller class for current template. If a matching class is found, a Controller object gets instantiated, and the constructor method of the Controller class sets it up and calls its init() method.
  5. A view file is selected for the View component. Unless that view file is "default", the PageRenderNoCache Session variable is set to avoid accidentally caching the output of a temporary (or alternative) view file.

    Rules used for selecting the view file:

    a) By default a view file called "default" is used.
    b) If "allow_get_view" configuration setting has been enabled, GET parameters can be used to set the view file – but only to the extent allowed by said configuration setting.
    c) If a view file has been defined programmatically (in Controller or a hook), then that file is used instead.
  6. The Wireframe bootstrap file calls render() method of Wireframe, rendering the page using layout and view files provided for the View component, and finally outputs the resulting markup.

Modifying the program flow with hooks

The contents of Controllers, layouts, partials, components, and view files are always up to you (as the developer of the site), but if you need to dig a bit deeper and modify the program flow as well, you can do that by hooking into various points described above.

While it's quite easy to find hookable methods by searching for "___" (three underscores) in the Wireframe source code, here are some examples of where you might start from:

Note that since Controllers and Components ultimately derive from the ProcessWire Wire object, you can also make your own methods hookable.

Back to top