Chapter 1. Templates

Table of Contents

1.1. Introduction
1.2. Template structure
1.3. How to start your own template
1.4. The Phorum template language
1.4.1. Introduction
1.4.2. General syntax
1.4.3. Data types Integers Strings PHP constants Template variables
1.4.4. Statements Display a variable In line comments DEFINE VAR IF .. ELSEIF .. ELSE .. LOOP INCLUDE HOOK
1.4.5. Need the power of PHP?

1.1. Introduction

Phorum uses a template system for separating application code from presentation code. Application code contains all the logic that is needed for running Phorum. This is PHP code which is maintained by programmers. Presentation code is used to translate the data that is generated by the application code into a HTML page that can be viewed by the end user. This Presentation code can be maintained by HTML designers.

The big advantages of this type of system are that HTML designers will not be bothered with complicated PHP code and that it is easy to create multiple presentation styles for Phorum.

Although there is no application logic in the templates, it is still possible to put presentation logic in there. Presentation logic is only used for things like making decisions on what to show and how to show it and for processing data that has been generated by the application code. For writing presentation logic, a very simple custom programming language is available (more on that will follow when we talk about the Section 1.4, “The Phorum template language”).