Templates

Templates are pieces of HTML code, that are used or combined by the framework to generate the HTML pages that are sent to the browser.

Template variables

The templates may contain variables inside them (called "template variables"), which are replaced by the framework with their string values. The variables inside a template are denoted by double curly braces: {{#tpl_var}}.

The <include> tag

The templates may also contain some extra tags, which are not HTML tags. These tags are reckognised and processed by the framework. One of them is the <include> tag, which is used to include another template inside the current template:

  <include src="file_to_be_included" />

It is a very useful tag, because it allows to separate pages into subtemplates, which results in a better structured application, provides modularity (the graphical designer can work with smaller pieces of code), and reusability (templates are easier to be reused in other pages or other applications).

Comments

The templates may contain some special comments as well:

  <!--# Framework comments -->

These comments are like HTML comments by they have a diesis (#) at the opening mark. These comments are not processed by the framework and are not displayed in the HTML page that is generated.

JavaScript code and stylesheet of a template

If a certain template has some javascript code or some special styles of its own, then it is better to include them at the begining of the template (instead of including them globally, at the header of the page). This makes the template more independant from the other parts of the page and thus easier to use it again into another page. They are included like this:

  <script type="text/javascript" language="javascript" src="file.js"></script>
  <link type="text/css" rel="stylesheet" href="file.css">

The inclusion is much better than writting the JS and CSS code in the template because it separates the HTML code from the JS and CSS codes. It also is more efficient (has a better performance) because the next time that this template is loaded in browser again, most probably the browser will get "file.js" and "file.css" from the cache, instead of retrieving them again from the server.