1.4.2. General syntax

Templates are built using HTML code. Embedded in this HTML code, there can be template language statements. All template statements in the templates are surrounded by "{" and "}" characters. Here's a simple example of what a template could look like:

Example 1.2. Template example

<html>
 <head>
<title>{HTML_TITLE}</title>
 </head>
 <body>
Your username is: {USER->username}

{IF USER->username "george"}
  <b>Hello, George!</b>
{/IF}
 </body>
</html> 


Because curly braces have a special meaning in the templates, you have to take care when using them for other things than Phorum template code. This applies to plain PHP code, JavaScript code and CSS code that you use in your templates. To prevent the template engine from getting confused, you can add a space after "{" and before "}". Examples:

Code that will cause problems if used in a template file:

PHP: if ($a == $b) {print "They are the same!\n";}
JavaScript: if (a == b) {alert("They are the same!\n");}
CSS: #phorum .thing {font-size: 110%;}

What it should be written like:

PHP: if ($a == $b) { print "They are the same!\n"; }
JavaScript: if (a == b) { alert("They are the same!\n"); }
CSS: #phorum .thing { font-size: 110%; }<sbr/>