Files
smarty/docs/it/designers/language-builtin-functions/language-function-config-load.xml

149 lines
3.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.config.load">
<title>config_load</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
<colspec colname="type" align="center" />
<colspec colname="required" align="center" />
<colspec colname="default" align="center" />
<colspec colname="desc" />
<thead>
<row>
<entry>Nome Attributo</entry>
<entry>Tipo</entry>
<entry>Obbligatorio</entry>
<entry>Default</entry>
<entry>Descrizione</entry>
</row>
</thead>
<tbody>
<row>
<entry>file</entry>
<entry>stringa</entry>
<entry></entry>
<entry><emphasis>nessuno</emphasis></entry>
<entry>Nome del file di configurazione da importare</entry>
</row>
<row>
<entry>section</entry>
<entry>stringa</entry>
<entry>no</entry>
<entry><emphasis>nessuno</emphasis></entry>
<entry>Nome della sezione da caricare</entry>
</row>
<row>
<entry>scope</entry>
<entry>stringa</entry>
<entry>no</entry>
<entry><emphasis>local</emphasis></entry>
<entry>
Campo di applicazione delle variabili caricate,
che può essere local, parent o global. local significa
che le variabili vengono caricate nel contesto del
template locale. parent significa che le variabili
vengono caricate sia nel contesto locale che nel template
genitore che lo ha chiamato. global significa che le
variabili sono disponibili a tutti i template.
</entry>
</row>
<row>
<entry>global</entry>
<entry>booleano</entry>
<entry>no</entry>
<entry><emphasis>false</emphasis></entry>
<entry>
Se le variabili sono visibili o meno al template
genitore: equivale a scope=parent. NOTA: Questo attributo
è deprecato per via dell'esistenza dell'attributo scope,
ma è ancora supportato. Se è presente scope, questo valore
è ignorato.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Questa funzione è usata per caricare variabili nel template da
un file di configurazione.
Vedere <link linkend="config.files">Config Files</link> per
maggiori informazioni.
</para>
<example>
<title>funzione config_load</title>
<programlisting>
<![CDATA[
{config_load file="colors.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>
]]>
</programlisting>
</example>
<para>
I file di configurazione possono contenere sezioni. Potete caricare
variabili da una sezione con l'attributo aggiuntivo
<emphasis>section</emphasis>.
</para>
<note>
<para>
<emphasis>Le sezioni dei file di configurazione</emphasis> e la funzione
incorporata dei template chiamata <emphasis>section</emphasis> non hanno
nulla a che fare fra di loro, hanno soltanto lo stesso nome.
</para>
</note>
<example>
<title>funzione config_load con section</title>
<programlisting>
<![CDATA[
{config_load file="colors.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>
]]>
</programlisting>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->