Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 991
Zeile 1... Zeile 1...
1
Variables loaded from config files {#language.config.variables}
1
# Variables loaded from config files
2
==================================
-
 
Zeile 3... Zeile 2...
3
 
2
 
4
Variables that are loaded from the [config files](#config.files) are
3
Variables that are loaded from the [config files](../config-files.md) are
5
referenced by enclosing them within `#hash_marks#`, or with the smarty
4
referenced by enclosing them within `#hash_marks#`, or with the smarty
6
variable [`$smarty.config`](#language.variables.smarty.config). The
5
variable [`$smarty.config`](language-variables-smarty.md#smartyconfig-languagevariablessmartyconfig). The
7
later syntax is useful for embedding into quoted attribute values, or
6
later syntax is useful for embedding into quoted attribute values, or
8
accessing variable values such as \$smarty.config.\$foo.
-
 
9
 
-
 
Zeile -... Zeile 7...
-
 
7
accessing variable values such as `$smarty.config.$foo`.
Zeile -... Zeile 8...
-
 
8
 
-
 
9
## Examples
10
Example config file - `foo.conf`:
10
 
11
 
11
Example config file - `foo.conf`:
12
 
12
```ini
13
    pageTitle = "This is mine"
13
pageTitle = "This is mine"
14
    bodyBgColor = '#eeeeee'
14
bodyBgColor = '#eeeeee'
15
    tableBorderSize = 3
-
 
16
    tableBgColor = "#bbbbbb"
15
tableBorderSize = 3
Zeile 17... Zeile 16...
17
    rowBgColor = "#cccccc"
16
tableBgColor = "#bbbbbb"
Zeile 18... Zeile 17...
18
 
17
rowBgColor = "#cccccc"
19
        
18
```
20
 
19
 
21
A template demonstrating the `#hash#` method:
20
A template demonstrating the `#hash#` method:
22
 
21
 
23
 
22
```smarty
24
    {config_load file='foo.conf'}
23
{config_load file='foo.conf'}
25
    <html>
24
<html>
26
    <title>{#pageTitle#}</title>
25
    <title>{#pageTitle#}</title>
27
    <body bgcolor="{#bodyBgColor#}">
26
    <body bgcolor="{#bodyBgColor#}">
28
    <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
27
        <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
29
    <tr bgcolor="{#rowBgColor#}">
28
            <tr bgcolor="{#rowBgColor#}">
30
        <td>First</td>
29
                <td>First</td>
31
        <td>Last</td>
30
                <td>Last</td>
32
        <td>Address</td>
31
                <td>Address</td>
Zeile 33... Zeile -...
33
    </tr>
-
 
34
    </table>
32
            </tr>
35
    </body>
33
        </table>
36
    </html>
-
 
Zeile -... Zeile 34...
-
 
34
    </body>
37
 
35
</html>
38
        
36
```
39
 
37
        
40
A template demonstrating the
38
A template demonstrating the
41
[`$smarty.config`](#language.variables.smarty.config) method:
39
[`$smarty.config`](language-variables-smarty.md#smartyconfig-languagevariablessmartyconfig) method:
42
 
40
 
43
 
41
```smarty
44
    {config_load file='foo.conf'}
42
{config_load file='foo.conf'}
45
    <html>
43
<html>
46
    <title>{$smarty.config.pageTitle}</title>
44
<title>{$smarty.config.pageTitle}</title>
47
    <body bgcolor="{$smarty.config.bodyBgColor}">
45
    <body bgcolor="{$smarty.config.bodyBgColor}">
48
    <table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}">
46
        <table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}">
49
    <tr bgcolor="{$smarty.config.rowBgColor}">
47
            <tr bgcolor="{$smarty.config.rowBgColor}">
50
        <td>First</td>
-
 
51
        <td>Last</td>
48
                <td>First</td>
Zeile 52... Zeile 49...
52
        <td>Address</td>
49
                <td>Last</td>
Zeile 53... Zeile 50...
53
    </tr>
50
                <td>Address</td>
54
    </table>
51
            </tr>
55
    </body>
52
        </table>
56
    </html>
53
    </body>
57
 
54
</html>
58
        
55
```
59
 
56
 
60
Both examples would output:
57
Both examples would output:
61
 
58
 
62
 
59
```html
63
    <html>
60
<html>
64
    <title>This is mine</title>
61
    <title>This is mine</title>
65
    <body bgcolor="#eeeeee">
62
    <body bgcolor="#eeeeee">
66
    <table border="3" bgcolor="#bbbbbb">
-
 
67
    <tr bgcolor="#cccccc">
63
        <table border="3" bgcolor="#bbbbbb">
Zeile 68... Zeile 64...
68
        <td>First</td>
64
            <tr bgcolor="#cccccc">
69
        <td>Last</td>
65
                <td>First</td>
70
        <td>Address</td>
66
                <td>Last</td>
Zeile 71... Zeile 67...
71
    </tr>
67
                <td>Address</td>
72
    </table>
68
            </tr>