shop-old/libs/smarty/docs/designers/language-variables/language-config-variables.md
Thomas Bartelt 0a669704ea Dev-Umgebung: Kompatibilität für PHP 8.3 + Smarty 4.5.6
- Smarty 4.1.1 → 4.5.6 (behebt dynamic property deprecations)
- Core-Klassen: #[\AllowDynamicProperties] für Admin_role, base, Config,
  Customer, Customer_group, CustomerGroups, Item, Structure, website
- website.class.php: counts[parent_id] initialisieren vor ++ (PHP 8.1)
- layout.class.php: HTTP_ACCEPT_LANGUAGE mit isset-Guard
- website_init.php: session_status()-Check vor session_start
- .htaccess: HTTPS-Redirect via X-Forwarded-Proto (statt SERVER_PORT)
- themes/easyshop_advanced/media/: Parent-Theme-Assets nachgezogen
- .gitignore: smarty.4.1.1.bak ausschließen
2026-04-20 01:19:01 +02:00

2.3 KiB

Variables loaded from config files

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

Examples

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 $smarty.config method:

{config_load file='foo.conf'}
<html>
<title>{$smarty.config.pageTitle}</title>
    <body bgcolor="{$smarty.config.bodyBgColor}">
        <table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}">
            <tr bgcolor="{$smarty.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}.

See also variables and $smarty reserved variables.