Dynamic web pages

Every web page calls index.php file in the main directory. This is because this script sets up the environment, opens a connection to the db, includes classes that will be always used and so on. Besides this it implements the main processing loop assembling a page from its slots, and provides basic security.

Pages are assembled by their slot pieces, as defined in pagexml directories. Since Obliquid 0.6.0, there are two such directories, one in the common directory tree and one in the local directory tree: so we have common/pagexml and local/pagexml. Pages can be defined both in the common tree or in the local tree, but when a page with the same name is found in both the common and the local tree, the local tree takes precedence; in fact this is the way to redefine (object oriented programmers may like the term overload) an existing page to make your own changes. Using the site configuration interface, a page will in a locked state, with no changes allowed until you push the button Copy to local to modify. By pushing this button, a page definition will be copied from common/pagexml to local/pagexml, for example the home page would be copied from common/pagexml/core/home.xml to local/pagexml/core/home.xml.

Let's look in more detail to the directory structure inside a pagexml directory first. There we can find a list of directories, one directory for each module. There is a simple rule for naming a page: <module name>_<short name>. For example the page named news_item is from module news and has item as short name. This page will be saved either in common/pagexml/news/item.xml or in local/pageml/news/item.xml. The only exception to this rule is for the page named home, that is part of module core, but doesn't require the core_ prefix.

Each page definition is a little XML that explains how the page is going to be built starting from the slot bricks. The format is not complicated, but there is no need to know it, since the Configure site function will change these files for you.

If you are curious, or want to know more about Oliquid, I give some basic explanations here. The first line in this example is the XML definition line and must always exist. The second line has a PAGE element: the NAME attribute of this element defines the page name, and should match the name coming from the file path (news/item.xml -> news_item). The relative url for this page is '/index.php?page=news_item'. Pages names are used in the url, and stored in XML, and for this reason it's advised to stick to a conservative set of characters (lowercase letters a-z, and underscore _).


<?xml version="1.0" encoding="UTF-8"?>
<PAGE NAME="news_item" TPL="common" FRAME="frame" GROUP="news">
  <SLOT NAME="core/nav" PHP="common" TPL="common" POSITION="center1" BLOCK="none"/>
  <SLOT NAME="core/changelang" PHP="common" TPL="common" POSITION="left2" BLOCK="title"/>
  <SLOT NAME="news/item" PHP="common" TPL="common" POSITION="center2" BLOCK="title_em"/>
  <SLOT NAME="news/viewitem" PHP="common" TPL="common" POSITION="center2" BLOCK="title"/>
</PAGE>

[Note]Previous format, valid until Obliquid 0.5.0 included

Pages were defined in 'local/configs/config.xml' in a single XML file. This file had a PAGE element for each page type, and was not that easy to upgrade, because if modified, either by hand, or with Obliquid configuration, an upgrade needed the tedius task to find differencies manually between the new config.xml file and the existing one. Another concern that has been addressed with the new syntax is about the size of the file (reaching 600 lines), which made XML dom parsing slow. The syntax of the PAGE element has not been modified (Obliquid 0.6.0).