Skip to content

11. Application Structure

Simon Striekwold edited this page Mar 29, 2018 · 2 revisions

This page is a more in depth look at the What happens when a page is loaded section from the introduction. The main purpose of this page is to help debugging the framework, but it can also be helpful to better understand the request cycle.

  1. Apache recieves the request, and because of the .htaccess reroutes the request to index.php.

  2. index.php calls the Smts::Init() function with the unloaded config array.

  3. Smts::Init() calls the EnvSetup() function with the unloaded config array. And does the following:

    • Loads the config.
    • Sets two headers: X-Frame-Options: DENY and Content-Security-Policy: frame-ancestors 'none', which disabled iframes of the site.
    • Starts the session.
    • If CustomErrors is set to true in the config: sets all error handelers to FrameworkCore::Error and sets display_errors to off
  4. Smts::Init() sets the Smts::$session variable.

  5. Smts::Init() gets the module/controller/action path from the GetPath() function, if a module is selected the GetPath() function redirects the request to that modules init function.

  6. Smts::Init() calls RouteRequest() which calls: the selected controllers BeforeAction, and then the selected action in the selected controller.

You are now in the controller code, and can call a model or Render() to get data from a model or load a view.

unloaded config array

When the config gets loaded, the variables in the selected Env are placed in the config.

Clone this wiki locally