Kezoor Documentation: The basics

You can browse our documentation by category or search by tags.
Templates, what is it?

The templates are basically files in HTML format that contain special codes to interact with the system. These templates provide an easy user-friendly interface to modify website designs as well as provide a safe styling since there is no critical code in the templates.

keZoor Templates

keZoor has its own templates engine, in order to properly edit the template files ( files with extension .TPL ) you will need to know some basic handling rules.
The following examples will show keZoor specific codes that you will find inside .TPL files. These specific codes are needed for keZoor to be able to handle the .TPL file properly.  You must keep them if you do a re-design or you will change some code, we will explain how they work and what they do when editing a file.

If you use a HTMLEditor such as Dreamweaver, be sure that the editor did not modify the 'Template Codes' shown here. Be aware that this 'Template Codes' will not be visible in the HTML Output display of the HTMLEditor since any text between <!-- and --> is hidden, also, be aware that writing this 'Template Codes' from the HTMLView (and not in the HTMLSource) will not create the proper 'Template Code' since the special characters such as "<" will be translated to the equal HTML representation, for example, in this case '&lt;' instead of a '<'.

Let's see a Template file example.tpl:

My template File

<!-- TPL BEGIN: example --> 

<div id="main_box">
Hi, this is a main box.<BR>
</div>

<div id="second_box">
    Hi, this is the second box.<BR>
    <div id="items_of_second_box">
    <!-- TPL BEGIN: example.items --> 
        <div id="item">I am the item number {!EX.item_number!}</div>
    <!-- TPL END: example.items -->     
    </div>
</div>

<!-- TPL END: example -->

All the colored text is keZoor Template Specific, everything else is HTML code.
The 'Template Codes' <!-- TPL BEGIN: example --> and <!-- TPL END: example --> denote where the template start and end, in this case, this 'Template Code' is named "example". Anything outside of the 'Template Codes'  will be discarded by keZoor, meaning that the text on the first line of the file that reads "My template File" will be ignored by keZoor, as well as anything else above the BEGIN and below the END 'Template codes'.
The 'Template Codes' <!-- TPL BEGIN: example.items --> and <!-- TPL END: example.items --> denote a 'Sub Template Code', since it is inside another 'Template Code' and will only be processed inside the pertinent code.
The 'Template Mark' {!EX.item_number!}   denotes a place to be replaced by what "EX.item_number" will be while keZoor is processing the template.

Upon request, for example, when a page that uses this template is executed, with a proper 'PHP Script' made to handle this template, keZoor could output the following code:
<div id="main_box">
Hi, this is a main box.<BR>
</div>

<div id="second_box">
    Hi, this is the second box.<BR>
    <div id="items_of_second_box">
        <div id="item">I am the item number 1</div>
        <div id="item">I am the item number 2</div>
        <div id="item">I am the item number 3</div>
    </div>
</div>

which in the page as HTML would be seen as:

Hi, this is a main box.

Hi, this is the second box.
I am the item number 1
I am the item number 2
I am the item number 3

What happend here is that keZoor requested to Load the 'Template Code'  from <!-- TPL BEGIN: example --> , this loaded all the Code until the <!-- TPL BEGIN: example.items --> , when this happend, keZoor loaded 3 times the 'Template Code' from  <!-- TPL BEGIN: example.items -->    to <!-- TPL END: example.items --> , and every time it did, the 'Template Mark' {!EX.item_number!}  had a different value, then closed the 'Template Code' with <!-- TPL END: example -->.
If the 'PHP Script'  were required to show more times the code <div id="item">I am the item number {!EX.item_number!}</div> would have been more outputs than 1, 2 and 3.

These 'Template Codes' define what the 'HTML Code' belongs to them, and if there are more 'Template Codes' inside, it only means that they are loaded if the parent is loaded too. The 'Template Marks' are values that keZoor will output, in the keZoor templates you will see 'Template Marks' such as which would refer to the title of a page, or which would refer to a PAR (Predefined Article) description, etc.


Conditionals

You may also find other 'Template Code' called Conditionals, the conditionals will define which HTML Code to output upon a comparison of a value, if the value is true, show one code, if it is false, show nothing or another code. Here is the example ONE with two Conditionals added:


My template File

<!-- TPL BEGIN: example --> 

<div id="main_box">
Hi, this is a main box.<BR>
<!-- CONDITION IF BEGIN: $MainItemExists == true -->
This item exists.
<!-- CONDITION IF END -->
</div>

<!-- CONDITION IF BEGIN: $SecondBoxItems > 5 -->
<div id="second_box">
    Hi, this is the second box.<BR>
    <div id="items_of_second_box">
    <!-- TPL BEGIN: example.items --> 
        <div id="item">I am the item number {!EX.item_number!}</div>
    <!-- TPL END: example.items -->     
    </div>
</div>
<!-- CONDITION IF ELSE -->
<div>
Not enough items to complete a second box.
</div>
<!-- CONDITION IF END -->

<!-- TPL END: example -->


We will recreate the same behavior as before, but this time, with these Conditionals included and we will assume that keZoor had the following values for the comparison:

$MainItemExists = true
; Will be true.
$SecondBoxItems = 3 ; Will be false.

This would be the output of the code:


<div id="main_box">
Hi, this is a main box.<BR>
This item exists.
</div>

<div>
Not enough items to complete a second box.
</div>

which in the page as HTML would be seen as:

Hi, this is a main box.
This item exists.

Not enough items to complete a second box.
A Conditional will only display the inside code if the condition is valid and if there is an ELSE, when the condition is not valid, will display the proper code, also, Conditionals can be inside or outside a Sub-'Template Code', but MUST be inside at least one 'Template Code'.
You can also see one Conditional inside another, as we see 'Template Codes'.

We will also refer to this Conditionals as 'Template Code'.

Kezoor Documentation

You can also access this documentation from within your Kezoor

Documentation

Templates 

Customizing
Where to start When customizing a keZoor theme, the right place is the 'Install/Uninstall Themes > Theme Templates Editor' and 'Install/Uninstall Themes > Theme CSS Editor'. ...
May 18, 2009 | Read the doc +
 
The Marks
Template Marks, what is it? The 'Template Marks' are special codes you write in the content or inside your templates that will be converted to a special content. These marks, for example, ...
April 15, 2009 | Read the doc +