config_load
Esta función es usada para cargar las #variables#
de un archivo de configuración dentro de un template.
Vea Config Files para mayor
información.
Ejemplo 7-2. Función {config_load}
ejemplo.conf
#this is config file comment
# global variables
pageTitle = "Main Menu"
bodyBgColor = #000000
tableBgColor = #000000
rowBgColor = #00ff00
#customer variables section
[Customer]
pageTitle = "Customer Info" |
y el template {config_load file="example.conf"}
<html>
<title>{#pageTitle#|default:"No title"}</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> |
|
Los archivos de configuración
pueden contener secciones también. Usted puede cargar variables de
una sección adicionando el atributo 'section'.
Nota:
Config file sections es la función integrada
de template {section}
no tiene nada que ver uno con el otro, ellos justamente por casualidad
tiene en común el convensionalismo del nombre.
Ejemplo 7-3. Función config_load con section {config_load file="ejemplo.conf" section="Customer"}
<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> |
|
Vea también Config files,
Config variables,
$config_dir,
get_config_vars()
y config_load().