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. User requests an URL belonging to a Page on the site. 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. If the Alternate Template Filename points to the Wireframe bootstrap file (usually wireframe.php in the /site/templates/ directory) Wireframe gets bootstrapped and initiated (configured).
  2. After booting up, Wireframe first checks for redirects. If a matching redirect rule is found, user is redirected right away and the Wireframe execution flow is halted.
  3. Assuming that we get this far – i.e. there were no matching redirect rules – the View component gets initialized and the $view API variable is set to refer to the View object.
  4. Wireframe looks for a Controller class for the template of current Page. If one is found, it gets instantiated. The constructor method of the Controller class sets the Controller object up and calls its init() method.
  5. Wireframe selects the view file for the View component. Unless the view file is "default", the PageRenderNoCache Session variable is set to avoid accidentally caching the output of a temporary (or alternative) view file. The rules used for selecting 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) that value is used instead.
  6. The bootstrap file calls the render() method of Wireframe, which in turn renders the Page using the 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, and views are always entirely up to you as the developer, 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.

The easiest way to find hookable methods is searching for "___" (three underscores) in the Wireframe source code, but here are some examples of where you might hook to:

Note that since Controllers extend the ProcessWire Wire object, you can also make your own controller methods hookable.

Back to top