HTML - index

Html Configuration

The main theme configuration of the site is the directory htm along with the files htm/html.ini and htm/templates.php.

The HTML module parses the HTML.INI file into an associative array. This array is accessed by the function html() which is passed the name of the variable to read: html('menu)' for example. If a variable is not set (does not exist) an empty string is returned. If html() is called with no arguments the entire array is returned.

During runtime a variable can be set by passing a value in the function call:

        html('foobar',"foo");

The value can be any PHP type but only strings and integers will make sense.

The TEMPLATES.PHP file is included by the html() function during start-up and that file simply creates the HTML "templates" by heredocs:

        $html['open'] = <<<HTML
        <!DOCTYPE html>
        <html>
        <head>
        <title>{\$html['title']}</title>
        <link href="{\$html['themedir']}default.css" rel="stylesheet" type="text/css">
        </head>
        <body>

That example defines the site's opening HTML template. As can be seen any other $html variable can be referenced within the $html array (self referencing is frowned upon).

In the above example title and themedir are set during start-up as the section being viewed and the theme name set by CONFIG.INI (or SECTIONS.INI). See SECTIONS and CONFIG.

Anything placed into the HTML.INI file will end up in the $html array.

Themes

A theme is a sub-directory of HTM/ and is set by themedir in either of the CONFIG.INI or SECTIONS.INI files. A theme expects to have both the HTML.INI and TEMPLATES.PHP files.

The default HTML.INI and TEMPLATES.PHP files are always read first so a theme need only override what it needs (and can add anything extra).

Although the default theme has a .CSS file such a file is not required for a theme.

Notes

1. The file is parsed by the PHP function parse_ini_file().