Virtual root

By default, all requests from users for an executable file (*.php) or folder are processed by the framework (Engine class) as follows: for each file listed below, for each virtual root from first to last searching for the specified files:

  1. directly requested php-file or file index.php in requested folder
  2. file .router.php up the directory hierarchy relative the query

As soon as the first file is found, it executes it, interrupting further search.
All active virtual roots must be registered in the config (key 'roots').


Suppose we have two virtual roots /Site/root and /BlackFox/root :

User request Searching for a corresponding entity
  • /Site/root/feedback.php
  • /BlackFox/root/feedback.php
  • /Site/root/.router.php
  • /BlackFox/root/.router.php
  • /admin/
  • /Site/root/admin/index.php
  • /BlackFox/root/admin/index.php
  • /Site/root/admin/.router.php
  • /BlackFox/root/admin/.router.php
  • /Site/root/.router.php
  • /BlackFox/root/.router.php
  • Following this logic, you can redefine any file in the framework’s virtual root by creating file in its virtual root along a similar relative path.

    If no file is found, the Engine searches for the redirect or content from the database (entities Redirects and Pages),
    if nothing has been found - it throws an exception ExceptionPageNotFound, which is subsequently processed in the Show404 method.

    Access to sections (folders)

    Framework allows to override template and wrapper for each section, as well as to restrict\allow access to the section and all subsections for specific user groups. To do this, you need to create a file .section.php in the root of the section and return the associative array in it, describing section (all keys are optional):


    return [
    	'TEMPLATE' => 'admin',
    	'ACCESS'   => [
    		'*'    => false,
    		'root' => true,

    • * — pseudo code for any user (includes unauthorized)
    • @ — pseudo code for authorized user
    • root — code of user group 'Root'

    For more complex access restriction logic, use exceptions in your own code.

    Template and wrapper

    When the request is completed, the engine wraps the result in a wrapper of template, if necessary.

    Ask question