This project is no longer active.

simple HTML Templating - language

Note: Little guidance to this documentation: "If you don't understand it, don't worry, it's not your fault." The problem is, I'm not good in writing such manuals but in the other hand I like to describe things in depth. Also my English is far from being my native language. So, if you don't understand something in these documents, feel free to ask. See support section.

Templating language reference:

How does the template variables look like?

Simple. They are almost like HTML tags.
<== variable>

The double '=' character identifies the template related tag. It must follow right after the opening bracket '<'. No text or empty space is allowed here. Optional white space characters (space, tab, new line, etc.) can be inserted before and after the variable name. The templating language is case sensitive which means that 'house' and 'HoUsE' are two different variables (TODO: make case sensitivity optional). Variable names can consist of letters and numbers and underscore ('_'). No white space letters are allowed inside the variable name. The look of the template tags is partly configurable, if you need it (see Configuration).
There are four posible types of constructions representing variable, loop, global scope variable within the loop and conditional construction.


<== variable_name>

Variable tag can be placed anywhere in the text. While processing, the tag will be replaced by value of the variable with corresponding name (see API documentation for setting the variables). Variable names can consist of letters and numbers. It can also contain '_' (underscore) but not as a first character. Variable names beginning with underscore identifies a loop.


<h1><== title></h1>
<a href="<== link_address>" title="<== link_desc>"><== link_name></a>
Warning: The engine doesn't contain any debugging functions yet. Incorrectly written template tags or variable names will be ignored and left unchanged.

Magic variables:

Magic variables are accessible within a loop and offer some useful information of its progress. Their name begins with 'mv_' and there is six of them. The first two always contains numbers. The rest of the variables is set only when they 'speak' the truth. They are designed to be used with conditional expression (see below). They are useful for formating the graphic output of the loop. Here they are: Using them you can easily color every odd line of the table which eases orientation in it.


<== _loop>
  <tr<== @if_mv_odd> bgcolor="silver"</== @if_mv_odd>>
    <td><== f_name></td>
    <td><== l_name></td>
    <td><== b_date></td>
</== _loop>


<== _loop_name>
  loop content
</== _loop_name>

Loops provide a simple way for creating lists of any kind. You can for example create a list of names and addresses, etc.
Tag representing loop works in pair with closing tag. It looks similar to HTML tags. Loops are identified by the '_' (underscore) character at the beginning of the loop name. Note that the underscore is part of the loop name and have to be written the same way when setting the variables (see API documentation). The ending tag of the loop must have exactly the same name as the opening one.

Inside of the loop content can be any text. It can also contain variable tags. The variables are of local scope and can be accessed only within the current loop (see API doc. on how to set these variables). Global variables aren't available inside any loop yet (TODO: solve this).


<== _people>
  First name: <== f_name><br>
  Last name: <== l_name><br>
  Address: <== address>
</== _people>
Any loop can also contain another loop.


<== _people>
  <p>First name: <== f_name><br>
  Last name: <== l_name><br>
  Address: <== address><br></p>
  <p>Assigned projects:<br>
  <== _projects>
    Name: <== p_name>, Assigned: <== p_assigned>, Deadline <== p_deadline>
  </== _projects>
</== _people>
Warning: Again please note that the engine doesn't have any debugging functions yet. Unclosed loops, incorrectly written names or different names in opening and closing tag can cause errors resulting in wrong formatting of the processed page.
And one more thing. Comments can be placed to the template code.


<== @if_variable_name>
  conditionaly processed block
<== @else_variable_name>
  conditionaly processed block
</== @if_variable_name>
Conditional constructions are known from most of programming languages. The part of the template in between the opening and closing conditional tag will be processed if the given variable_name exists (if it was set in the PHP/ASP code before processing, see API doc.). The '@else_' tag is optional. If the given variable exists, block between opening tag end else tag is processed. If it doesn't, the block between else end closing tag is processed instead.
For example if you have a list of articles to be printed out by some loop. In case that the article was written today, you set variable today. When processed, todays articles will display 'today' sign and the rest will show date of publication.


Article added:
<== @if_today>
<== @else_today>
<== date>
</== @if_today>


## text of the comment
Anything between the double hash ('#') and the end of line will be removed from the template code before processing. It's useful for designers to put some notes into the templates or to leave out some template tags.


Name: <== f_name><br> ## displays first name on the page
Age: ##<== age><br> temporarily disabled Logo

last version: 0.2.1

» » news « «


Closed officially. Finally. See more

A small fix, see changelog.

Second version is comming after a while with many news.

First vesion is out!