The LayManSys Call Stack

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.

Abstract

This chapter shows the order in which LayManSys processes files and calls certain functions. It is thought as a guide for developers that want to include LayManSys into their Content Management Systems or want to port the framework into another programming language.


Table of Contents

The Documents <head>
The Documents Footer

The Documents <head>

The first step, using an auto-generated header, is optional, so it is present here at the very beginning. Well, than let us start with the real "magig":

The file lib/laymansys.php sets the include path and includes the necessary modules, that are currently error.php, RDFParser.php, LayoutParser.php, header.php, frame.php, footer.php and config.php, all located in the lib/laymansys/ directory. It contains the "main" function LayManSysHeader that coordinates the complete LayManSys processing:

  1. Initializing the options for LayManSysHeader by merging the LayManSysDefaultHeaderOptions from config.php with the $options array passed as argument to LayManSysHeader.
    1. LayManSysDefaultHeaderOptions internally calls getRDFFile.
    2. Error handling is delegated to handle1stStageError.
  2. Now the RDF parser is created (file lib/laymansys/RDFParser.php) and parses the global etc/laymansys.rdf.
  3. This is directly followed by parsing the documents RDF file (method parseFile used for the option value my.rdf), so the RDF parser contains now the complete metadata of the web document.
  4. If necessary (as in most cases), a LayoutParser is created (file lib/laymansys/LayoutParser.php), merges the style information already collected with the information found in the layout configuration file (mergeStyles) and stores it in the metadata object.
  5. The complete HTML header is printed by the function writeHeader (in lib/laymansys/header.php):
    1. At first, the HTTP and HTML headers are prepared, e.g. creating the correct document type, and then written.
    2. This is followed by the documents title.
    3. The HTML meta information (using the meta tag) are written as a whole.
    4. In the same way the related links are processed.
    5. Since style information and JavaScript content are processed the same way, I sum them up here.
    6. The last action is closing the HTML <head> and optionally writing the documents main heading.
  6. Error handling is delegated to the function given with the option value errHandler, which is handle2ndStageError by default. The reason is that the HTTP and HTML header has been written, so we could print out error messages safely.
  7. The last step here is printing the navigation panel, if any (function printNavigation in lib/laymansys/frame.php), where one of the following actions is executed:
    • A static (HTML) navigation file is simply passed through using PHPs readfile.
    • If the navigation file is a dynamic one, that means, it is a PHP module, its function getNavigation is called.

The Documents Footer

The LayManSys finalization routine (that has to be called explicitly) writeFooter can be found in lib/laymansys/footer.php. This function writes

  1. the documents footer enclosured by an address tag containing the copyright statement (as set by the dc:Rights tag in either the global etc/laymansys.rdf or the documents RDF file
  2. a link to the imprint or a page with detailed copyright notices.