Skip to main content

Template Basics

ProBoards Forums themes use templates and variables to build out the HTML structure that will be displayed to the user.

Syntax

Templates utilize standard HTML combined with ProBoards Template System variables.

Variables

Variables are used to insert dynamic, or pre-generated content in templates. The format of a template variable will always appear as: $[variable_name].

Single use variables

Some variables have a single purpose usage and are replaced with either text or some other value.

$[title] - will display the title of the forum

Code Example

<span>
$[title]
</span>

will become

<span>
Forum Title
</span>

Example single use variables

timestamp

Objects (variables with properties)

Properties in variables allow for a more detailed representation of its values and are denoted by being added to the variable name after a .: $[variable_name.property].

$[user] is a variable with properties. Using the variable with no properties will generate a link to the user in question.

Code Example

<span>
$[user]
</span>

Becomes:

<span>
<a href="https://forum-url.proboards.com/user/1">Admin</a>
</span>

By using properties, we can choose specific parts of the variable to display instead:

<span>
User ID: $[user.id]<br>
Display Name: $[user.name]<br>
Username: $[user.username]
</span>

Will become:

<span>
User ID: 1<br>
Display Name: Admin<br>
Username: admin
</span>

Array variables

Array variables contain a list of one or more other variables. To access the contents, the array must be looped with a foreach

Code Example

Comments

The template system uses HTML comments.

<!-- This will be commented out -->