What template variables are available in xyz.tpl?
Question:
Q: I'm trying to customize my templates. Which variables are available to use in each template?
Answer:
Each template has a different purpose and will have different variables available to it. For the most part, the variables that are already used in the templates are the ones that are available to it. In some cases, more variables may be available, however it would be impractical to maintain a list of every variable available to every template due to the huge number of templates and variables involved.
Useful Tips
If you see a variable such as {$array.value}
(i.e., if it starts with a $
and contains a period) this often
represents a row from a database table.
For example, in templates/client/payment_details.tpl
, you'll see variables named {$payment.amount}
and
{$payment.method}
. In this case, {$payment}
is a row from the payments
database table, so any of the database
fields in that table can be used. You can determine which values are available by using phpMyAdmin or similar to
examine the relevant database tables -- the payments
table in this case. Similarly, you'll find a variable named
{$account.id}
in this template -- here, {$account}
is a row from the accounts
table corresponding to the user who
made the payment, so you can use any of the other fields from the accounts
table (such as {$account.email}
and
so-on) in this template.
There is no consistent way to determine which template variables correspond to which database tables as the names are
assigned on an as-needed basis (and in some cases, the variable will be constructed on-the-fly so it won't correspond
to any table at all), however when available, the template variable names usually correspond roughly to the database
table names (such as {$payment}
for the payments
database table in the example above).