mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-03 22:01:36 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			124 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			124 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
<?xml version="1.0" encoding="iso-8859-1"?>
 | 
						|
<!-- $Revision$ -->
 | 
						|
		<sect1 id="language.function.include">
 | 
						|
			<title>include</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>sì</entry>
 | 
						|
                        <entry><emphasis>nessuno</emphasis></entry>
 | 
						|
                        <entry>Nome del file di template da includere</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>assign</entry>
 | 
						|
                        <entry>stringa</entry>
 | 
						|
                        <entry>no</entry>
 | 
						|
                        <entry><emphasis>nessuno</emphasis></entry>
 | 
						|
                        <entry>Nome della variabile cui sarà assegnato
 | 
						|
                                                l'output dell'include</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>[variabile ...]</entry>
 | 
						|
                        <entry>[tipo variabile]</entry>
 | 
						|
                        <entry>no</entry>
 | 
						|
                        <entry><emphasis>nessuno</emphasis></entry>
 | 
						|
                        <entry>Variabile da passare localmente al template</entry>
 | 
						|
                    </row>
 | 
						|
                </tbody>
 | 
						|
                </tgroup>
 | 
						|
            </informaltable>
 | 
						|
			<para>
 | 
						|
	    I tag include sono usati per includere altri template in quello attuale.
 | 
						|
	    Tutte le variabili del template corrente sono disponibili anche nel
 | 
						|
	    template incluso. Il tag include deve comprendere l'attributo "file",
 | 
						|
	    che contiene il percorso del template da includere.
 | 
						|
			</para>
 | 
						|
			<para>
 | 
						|
			Opzionalmente si può passare l'attributo <emphasis>assign</emphasis>,
 | 
						|
			che specifica un nome di variabile del template alla quale
 | 
						|
			sarà assegnato l'output dell'<emphasis>include</emphasis>, invece
 | 
						|
			di essere visualizzato.
 | 
						|
			</para>
 | 
						|
<example>
 | 
						|
<title>funzione include</title>
 | 
						|
<programlisting>
 | 
						|
{include file="header.tpl"}
 | 
						|
 | 
						|
{* qui va il corpo del template *}
 | 
						|
 | 
						|
{include file="footer.tpl"}</programlisting>
 | 
						|
</example>
 | 
						|
			<para>
 | 
						|
	    Potete anche passare variabili ai template inclusi sotto forma di
 | 
						|
	    attributi. Queste variabili saranno disponibili soltanto nello
 | 
						|
	    scope del file incluso. Le variabili attributo prevalgono su quelle
 | 
						|
	    del template attuale in caso di omonimia.
 | 
						|
			</para>
 | 
						|
<example>
 | 
						|
<title>funzione include con passaggio di variabili</title>
 | 
						|
<programlisting>
 | 
						|
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
 | 
						|
 | 
						|
{* qui va il corpo del template *}
 | 
						|
 | 
						|
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}</programlisting>
 | 
						|
</example>
 | 
						|
			<para>
 | 
						|
			Usate la sintassi delle <link
 | 
						|
			linkend="template.resources">risorse dei template</link> per
 | 
						|
			includere file esterni alla directory $template_dir.
 | 
						|
			</para>
 | 
						|
<example>
 | 
						|
<title>esempi di funzione include con le risorse dei template</title>
 | 
						|
<programlisting>
 | 
						|
{* percorso assoluto *}
 | 
						|
{include file="/usr/local/include/templates/header.tpl"}
 | 
						|
 | 
						|
{* percorso assoluto (come sopra) *}
 | 
						|
{include file="file:/usr/local/include/templates/header.tpl"}
 | 
						|
 | 
						|
{* percorso assoluto su windows (NECESSARIO usare il prefisso "file:") *}
 | 
						|
{include file="file:C:/www/pub/templates/header.tpl"}
 | 
						|
 | 
						|
{* include da una risorsa chiamata "db" *}
 | 
						|
{include file="db:header.tpl"}</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
 | 
						|
-->
 |