-
Notifications
You must be signed in to change notification settings - Fork 0
url routing
PATH_INFO is parsed incrementally from the lowest level, and goes till the next higher level is an invalid controller.
-
When the deepest possible controller is found, the subsequent parameters are filled in the $_PARAM global array
-
To support directories as controllers, index.php of that directory is called when directory is tried to be accessed.
-
For example, when
[base_url]parent_dir/called_dir/the_parameter.php
is called, -
[base_path]app/parent_dir/called_dir/the_parameter.php
is called if it exists with empty $_PARAM, otherwise -
[base_path]app/parent_dir/called_dir/index.php
is called if it exists withthe_parameter
in $_PARAM, otherwise -
[base_path]app/parent_dir/called_dir.php
is called if it exists withthe_parameter
in $_PARAM, otherwise -
[base_path]app/parent_dir/index.php
is called if it exists withcalled_dir
andthe_parameter
in $_PARAM, otherwise -
[base_path]app/parent_dir.php
is called if it exists withcalled_dir
andthe_parameter
in $_PARAM, otherwise -
[base_path]app/index.php
is called if it exists withparent_dir
,called_dir
andthe_parameter
in $_PARAM, otherwise a 404 error is triggered, and another error is triggered requiring presence of index.php -
Also, the
[base_path]app/parent_dir/called_dir/index.php
can be called (if exists) by using[base_url]parent_dir/called_dir/index
-
PHP files/directories with name starting with a _ (underscore) are not allowed to be called via. the Router
-
When such a request is made, the parent controller applicable is called with the requested path/file in $_PARAM.
-
Note that a directory of type _dir restricts access to everything under it, and the components of remaining path are passed in $_PARAM
-
Direct access is still possible if not blocked by .htaccess or your own mechanisms (like checking the constant FRAMEWORKED)