A zoglair generated web page starts out from a master HTML template, provided by the active skin. This is in contrast with other template systems, you might have worked with, where separate templates for the header, body and footer parts, are used. It is also worth pointing out that there is only one master template in a skin. Inside that template, you can use conditional structures, if you want, to switch layouts among pages.

The master template is a complete HTML document, from <!DOCTYPE> to </html>. Inside that, you place dynamic content by calling zoglair functions. As the language used, for template parsing, is PHP itself, there is no limit to what you can actually display in a master template. The whole zoglair and PHP system is at your disposal. There are, of course, some utility functions specially made for template usage, but the important thing to remember is that you are not limited to them.

Generally speaking, however, a master template should be dealing with just menu and column placement. Don't forget that the same template will be used for all site pages, so, it must be generic. Zoglair gives the site owner the ability to change menus at will, and choose what goes in a page column.

The following code is an example of a master HTML template:

<?php echo $this->render_unit_doctype($Unit)."\n" ?>
    <?php echo zoglair::indent($this->render_unit_head($Unit), 1)."\n" ?>
<div id="page">
    <div id="head">
    <div id="body">
        <div id="title" class="lrc">
            <div class="left">
                <?php echo sprintf('<h1>%s</h1>', $Unit->get_info('z_con/title')))."\n" ?>
            <div class="right">
                <?php echo zoglair::indent($this->render_unit_buttons($Unit), 4)."\n" ?>
        <div id="zBody" class="lrc <?php echo $this->render_unit_column($Unit, 'cols', FALSE) ?>">
            <div id="zBodyMain" class="zBodyMain left">
                <?php echo zoglair::indent($this->render_unit_column($Unit, 'main', TRUE), 4)."\n" ?>
            <div id="zBodySbar" class="zBodySbar right">
                <?php echo zoglair::indent($this->render_unit_column($Unit, 'sbar', TRUE), 4)."\n" ?>
    <div id="copy" class="lrc">
        <div class="left">
            <?php echo $zoglair->get_info('domain/copyleft'  )."\n" ?>
        <div class="right">
            <?php echo $zoglair->get_info('domain/copyright' )."\n" ?>
        <div class="center">
            <?php echo $zoglair->get_info('domain/copycenter')."\n" ?>
< /body>

Besides the familiar HTML tags, you will notice a few PHP statements, sharing a common syntax. The generic form you use, to print out anything, is:

<?php echo ... ?>

Replace ellipsis (...) with whatever you want to print.

You will also notice a few instances of zoglair::indent() and "\n". These are totally optional, and are used to output a properly indented markup. If you do not care about proper indentation, you may just ignore them.

Finally, there are 3 objects, whose methods are called:

  1. $this is the instance of your skin, a descendant of link,
  2. $Unit is the instance of the active unit, a descendant of link, and
  3. $zoglair

You can find a full reference of the objects' available methods in the links provided. As for their properties (accessible through get_info()), you can see them at runtime via a debugging session, with the “Core Dump” option selected.

(C) Nick B. Cassos - All Rights Reserved
powered by zoglair
page generated in 80ms (11 queries, 14ms)