Learning: Templates

The template is the fundamental unit of site design in eZ publish. It’s basically a html file that contains logic to define how content is to be displayed. It’s similar in concept to most template systems, eg. smarty templates. Or for those of you that use straight php coding, it would be a php file that contains html for display of content.

  • All templates have the .tpl extention.
  • A template contains html and eZ publish code.
  • The html follows the the XHTML 1.0 Transitional standard.

The ez publish code follows their proprietry scripting language which is quite similar to php in syntax. It’s pretty much like most scripting language and doesn’t take much to learn. eZ publish code makes it possible to get content from the database and perform logical functions, eg. conditional statements (if/then) and looping (while/do).

Templates are combined to form the final html output. The main template is pagelayout.tpl which contains the HTML, HEAD and BODY tags. It dictates the overall look of a site.

Each request to an eZ publish site will run the “view” of a module. In most cases this wil be the content module (more about modules later). The module will process the pagelayout template, which then in turn will process and included templates to then produce the final results which will be returned to the user as flat html.