From config files

Variables that are loaded from the config files are referenced by enclosing them within #hash_marks#, or with the tplix variable $tplix.config. The later syntax is useful for embedding into quoted attribute values, or accessing variable values such as $tplix.config.$foo.

Example config file - foo.conf:
pageTitle = "This is mine"
bodyBgColor = '#eeeeee'
tableBorderSize = 3
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"
A template demonstrating the #hash# method:
{config_load file='foo.conf'}
<html>
    <title>{#pageTitle#}</title>
    <body bgcolor="{#bodyBgColor#}">
        <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
            <tr bgcolor="{#rowBgColor#}">
                <td>First</td>
                <td>Last</td>
                <td>Address</td>
            </tr>
        </table>
    </body>
</html>
A template demonstrating the $tplix.config method:
{config_load file='foo.conf'}
<html>
<title>{$tplix.config.pageTitle}</title>
    <body bgcolor="{$tplix.config.bodyBgColor}">
        <table border="{$tplix.config.tableBorderSize}" bgcolor="{$tplix.config.tableBgColor}">
            <tr bgcolor="{$tplix.config.rowBgColor}">
                <td>First</td>
                <td>Last</td>
                <td>Address</td>
            </tr>
        </table>
    </body>
</html>

Both examples would output:

<html>
    <title>This is mine</title>
    <body bgcolor="#eeeeee">
        <table border="3" bgcolor="#bbbbbb">
            <tr bgcolor="#cccccc">
                <td>First</td>
                <td>Last</td>
                <td>Address</td>
            </tr>
        </table>
    </body>
</html>

Config file variables cannot be used until after they are loaded in from a config file. This procedure is explained later in this document under {config_load}.

Was this article helpful?