Operational sequence in phpCMS (Overview)

From phpCMS

Jump to: navigation, search

[edit] Operational sequence in phpCMS – an overview

Here is a short description of the processes taking place and in what order when phpCMS generates a page (somewhat simplified for easy understanding).
(This is based on the English demo delivered with the downloadable phpCMS package (demo-en).

large image
phpCMS workflow
  1. The user calls a page, e.g. index.htm.
  2. The browser looks into the .htacces file and finds that it shall address the call for index.htm to phpCMS (this is due to entries like 'AddType application/x-httpd-parse .htm' and 'Action application/x-httpd-parse "/parser/parser.php?file="' in the .htaccess file).
  3. phpCMS reads the index.htm content file and looks for the content of the field {PROJECT}, pointing to the project file (including the path), e.g. ./template/home.en.ini.
  4. phpCMS reads the project file ./template/home.de.ini.
  5. The placeholders $home and $plugindir are set according to the entries in the project file.
    Furthermore phpCMS reads the other entries in the project file to find out which page template (.tpl), menu template (.mtpl), menu file (.mnu), and tag file (.tag) it shall load.
  6. phpCMS reads these files:
    • page template: /template/home.en.tpl,
    • menu template: /template/home.en.mtpl,
    • menu file: /template/home.en.mnu,
    • tag file: ./template/home.tag.
  7. phpCMS looks into the page template and loads all sub-templates (included by a {TEMPLATE FILE="..."} placeholder) and includes their content into the page template at the correct place. In case a sub-template includes itself further sub-templates, their content is also included.
    In the template ./template/home.en.tpl of the demo, the sub-template header.de.tpl is included at the start and the sub-template footer.en.tpl at the end. header.en.tpl in turn includes the sub-template meta.en.tpl.
  8. After phpCMS has assembled all the included templates (home.en.tpl, header.en.tpl, footer.en.tpl and meta.en.tpl) to form a big template for all the parts of the page, it parses this template line by line and replaces all placeholders it finds by the contents found in the different files that these placeholders point to:
    • placeholders, starting with {PLUGIN...} are replaced by the output of the corresponding plugin,
    • placeholders, starting with {MENU ...} are replaced by the correspondig menu (see below for more details),
    • placeholders, starting with {SCRIPT...} are replaced by the output of the corresponding script,
    • all other placeholders are replaced by the corresponding content from the content file. In the demo that are e.g. placeholders like {TITLE} and {CONTENT}.
  9. phpCMS replaces all tags, which are defined in the tag-file.
  10. After all placeholders and tags are replaced, the page is then delivered to the user.

Now to the menu:

When finding a placeholder, starting with the keyword {MENU ...}, phpCMS builds the menu from the content of the menu file (.mnu) based on the layout defined in the menu template (.mtpl) and includes that at the location of the placeholder into the page. The menu file thereby defines the items of the menu, and the menu template defines the layout.

As stated before, this overview is meant to enable the user to understand the logic behind the processing of phpCMS. It does not represent that logic exactly, e.g. the replacements based on the tags from the tag file do not happen at the end of the processing chain, but rather file by file when they are read. But these details are more relevant for people which e.g. want to program plugins.


Main Page: Main Page
« Previous Page: Quick Installation Guide | Top Page: User Documentation MainPage | Next Page: System requirements »

Personal tools