Project

General

Profile

h1. URL-mapping

As you may notice Subrion CMS system has SEO-friendly URLs with no ".php" extensions, however there are no appropriate rewrite rules in the .htaccess file for some pages you expected.
Here you will find a detailed description on how it actually works.

  1. First of all, the .htaccess file redirects all the requests to index.php file.

  2. index.php defines certain required constants and, what's most important, it initialize the core class.

  3. The core class calls 2 main functions that parse requested URL and define what page should be displayed:

    $this->_parseUrl();
    $this->iaView->definePage();

  4. $iaCore->_parseUrl() function

  5. separates URL by entities and stores them into $iaCore->requestPath variable

  6. defines a type of the page (front-end or admin)

  7. defines the domain base URL

  8. defines current page language

  9. defines a type of the request (HTML, JSON, or XML)

  10. tracks whether logout page was requested. Proceeds the request.

  11. $iaView->definePage() function using data formed in $iaCore->_parseUrl() function

  12. searches for a page by previously defined page's name or alias

  13. defines if the found page belongs to any extras or was manually created

  14. defines page's title and (in some cases) its content

  15. defines php file that should handle the page

  16. returns 404 error if no pages were found.

Any page that comes with the Subrion core, its packages or plugins are stored in 'pages' and 'admin_pages' table. There you will find pages' names, urls and files' names that process pages.

Template file is set within php file using $iaView->display() function. If these function is absent it will read [page_name].tpl file by default.

Here is a couple of real examples:

Suppose 'pages' table contains the next record:

name: help
alias: [empty]
filename: page
extras: [empty]

If you're requesting http://yourdomain.com/help/ the script will define the page as follows:

  • the page is front-end page
  • requested path is 'help/'
  • according to the found record in the database with the name 'help' executing [subrion_folder]/front/page.php file
  • Using predefined variables and constants to display the page.

If no records with the name 'help' or alias 'help/' were found the script returns 404 error.

Suppose 'pages' table contains the next record:

name: submit_article
alias: articles/add/
filename: manage
extras: publishing

If you're requesting http://yourdomain.com/articles/add/ the script will define the page as follows:
* the page is front-end page
* requested path is 'articles/add/'
* according to the found record in the database with the alias 'articles/add/' executing [subrion_folder]/packages/publishing/manage.php file
* Using predefined variables and constants to display the page.

If no records with the name 'articles/add' or alias 'articles/add/' were found the script returns 404 error.

You can find appropriate instructions on how to make packages and plugins to add pages during theirs installation on these pages:
http://dev.subrion.com/projects/subrion-cms/wiki/PackageStructure
http://dev.subrion.com/projects/subrion-cms/wiki/PluginStructure