Page Loop

The page loop is determined by the index.php file in the web root.
The loop goes through several stages before being completed by the reactor_exit();

Stages

  1. Include all the necessary files.
  2. Start PHP session
  3. Theme Handler(): Load theme.
  4. Start Routing and parse the incoming url to set variables.
  5. Connect to database.
  6. Start Cache. Depending on which class is loaded it will use memory or disk cache.
  7. Start Factory. The factory is used to generate html.
  8. Plugin_handler(): Load plugins.
  9. Taxonomy_handler(): Load and cache taxonomies for use.
  10. Load settings.
  11. Theme_switcher(): Register style for selected theme.
  12. Upload_handler(): Handle chunked file uploads.
  13. Upload_handler_direct(): Handle single file uploads.
  14. Form_handler(): handle form input
  15. Rewrite url to template.
  16. Close all connections.

Index.php

global $reactor,$parser,$factory,$routing;
/*
* The main CMS file.
* copyright {c) 2019 Patriek Jeuriens
*/

require_once '../config/definitions.php';
require_once '../config/bootstrap.php';

// start session
$session = new core_session();
$session->start($reactor->defaults->session['name'],$reactor->defaults->session['timeout']);

// handle theme
theme_handler();

// start routing
$routing = new core_routing();

// routing redirect
$routing->incoming();

// connect database
$sqldb = new core_sql(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

// start cache
$cache = new core_memcache();

// start factory
$factory = new core_factory();

// handle plugins
plugin_handler();

// pre-load taxonomies
taxonomy_handler();

// load settings
$reactor->site->settings = get_settings("site_settings");

// switch themes
theme_switcher();

// handle ajax requests
ajax_handler();

if (is_logged_in()) {
// handle upload requests
upload_handler();
// handle upload requests
upload_handler_direct();
// handle form requests
form_handler();
}

// routing rewrite
$routing->rewrite();

reactor_exit();

Description of the main PHP Engine loop.
Protected pages are page names that cannot be used for normal pages.
Learn how to create new plugins from scratch.
Learn how to build new themes from scratch.
Register new scripts and stylesheets.
Register new types to the core.
Register a new theme to the core.
We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies.
Do you want to accept tracking cookies?