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 second syntax is useful for embedding into quoted attribute values.

从配置文件读取的变量由"#"括起来.或者是smarty的变量 $smarty.config.
第二种语法在嵌入被引用的属性值的时候非常有用.

Example 4-5. config variables
例 4-5.从配置文件引用的变量

foo.conf:



pageTitle = "This is mine"

bodyBgColor = "#eeeeee"

tableBorderSize = "3"

tableBgColor = "#bbbbbb"

rowBgColor = "#cccccc"



index.tpl:



{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>



index.tpl: (alternate syntax)



{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>





OUTPUT: (same for both examples)



<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}.

配置文件的变量只有在它们被加载的时候才用到.
这个过程将在以后 {config_load}. 的文档里说明.