Template basics

Last modified: August 23, 2009 - 15:39

xTemplate creates Web pages by substituting place holder tags in a template, the xtemplate.xtmpl file, with content from the database.

There are two kinds of template place holder tags, section tags and item tags.

Section Tags

Section tags deal with the structure of a Web page, marking areas of the page, and are XHTML/HTML comment tags which look like this:

<!-- BEGIN: title -->

<!-- END: title -->

Some section tags mark areas were the content, and it's structure, will be repeated. For instance the comment section may be repeated more than once depending on how many comments are on a page:

<!-- BEGIN: comment -->
<!-- END: comment -->

Section tags can be nested, so that one set of section tags can be contained by another:

<!-- BEGIN: node -->
  <!-- BEGIN: title -->
  <!-- END: title -->
<!-- END: node -->

Item Tags

Item tags are place holders for content items, such as the title of a page, who the page was submitted by, or the main content of a page. Item tags look like this:

{title}
{submitted}
{content}

Item tags are associated with the section tag that surrounds them, for instance:

<!-- BEGIN: node -->
{title}
<!-- END: node -->

The {title} tag above is the main title of a page, while the {title} tag below is the title for the comments on a page.

<!-- BEGIN: comment -->
{title}
<!-- END: comment -->

 
 

Drupal is a registered trademark of Dries Buytaert.