XiTemplate Home Page XiTemplate
[ class tree: XiTemplate ] [ index: XiTemplate ] [ all elements ]
Prev Next
Template Anatomy

Template Anatomy

Description of template blocks and variables

Templates are made up of blocks and variables. The following sections will attempt to describe both in detail.

Template Blocks

Templates are made up of blocks. At least one block is required for a file to be a template. The required block is the main block.

The main block will contain the contents of the entire file. Any text outside of the main block will ignored and therefor will not be present after being parsed. This behavior can be useful for commenting templates.

Example:

this will be ignored
<!-- BEGIN: main -->

<p>this will be present after parsing</p>

<!-- END: main -->

The main block does not necessarily need to be named main but this is the default value assumed by XiTemplate and is therefor good practice to always start your template with a block named main.

Block syntax

Block markers must begin with <!-- followed by a space and BEGIN or END in capital letters followed by a colon : and a space and then the name of the block followed by another space and ending with -->. Block names can be any combination of lower and uppercase letters, numbers, and underscores. Blocks must have a beginning and an end marker. This syntax is very strict and any deviation from this syntax will break your template.

<!-- BEGIN: main -->
some content can go here
	<!-- BEGIN: another_block -->

	some more content can go here

	<!-- END: another_block -->

even more content can go here

<!-- END: main -->

Block hierarchy

The main block can have sub blocks and sub blocks can have sub blocks.

Example:

this will be ignored
<!-- BEGIN: main -->

<p>this will be present after parsing</p>

    <!-- BEGIN: whatever -->
    
    <p>This is a sub block</p>
    
        <!-- BEGIN: another -->
        
        <p>This is a sub block inside a sub block</p>
        
        <!-- END: another -->

    <p>this is part of the whatever block</p>
    
    <!-- END: whatever -->

<p>This is part of the main block</p>

<!-- END: main -->
This is outside of main and will also be ignored

The main block is the always parent block and must be parsed last. All other blocks are child blocks or sub blocks. Sub blocks can have child blocks of their own to an infinite level. Child blocks must always be parse prior to parsing a parent block.


Prev Up Next
Quick Start XiTemplate Manual Template Anatomy (continued)

Documentation generated on Fri, 20 Aug 2004 10:57:40 -0500 by phpDocumentor 1.3.0RC3