mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-03 22:01:36 +01:00 
			
		
		
		
	
		
			
	
	
		
			570 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
		
		
			
		
	
	
			570 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| 
								 | 
							
								<?xml version="1.0" encoding="iso-8859-1"?>
							 | 
						|||
| 
								 | 
							
								<!-- $Revision$ -->
							 | 
						|||
| 
								 | 
							
										<sect1 id="language.function.section">
							 | 
						|||
| 
								 | 
							
											<title>section,sectionelse</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>name</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>stringa</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>s<EFBFBD></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>nessuno</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Nome della sezione</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>loop</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>[$variable_name]</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>s<EFBFBD></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>nessuno</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Nome della variabile che determina il numero
							 | 
						|||
| 
								 | 
							
								                           di iterazioni del ciclo</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>start</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>intero</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>no</entry>
							 | 
						|||
| 
								 | 
							
														<entry><emphasis>0</emphasis></entry> <entry>L'indice
							 | 
						|||
| 
								 | 
							
														dal quale inizier<65> il ciclo. Se il valore <20> negativo,
							 | 
						|||
| 
								 | 
							
														la posizione di partenza <20> calcolata dalla fine dell'array.
							 | 
						|||
| 
								 | 
							
														Ad esempio, se ci sono sette valori nell'array da ciclare
							 | 
						|||
| 
								 | 
							
														e start <20> -2, l'indice di partenza sar<61> 5. Valori non
							 | 
						|||
| 
								 | 
							
														validi (cio<69> al di fuori della lunghezza dell'array da
							 | 
						|||
| 
								 | 
							
														ciclare) saranno automaticamente convertiti al valore
							 | 
						|||
| 
								 | 
							
														valido pi<70> vicino.</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>step</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>intero</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>no</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>1</emphasis></entry>
							 | 
						|||
| 
								 | 
							
														<entry>Il valore di passo da usare per attraversare
							 | 
						|||
| 
								 | 
							
														l'array da ciclare. Ad esempio, step=2 cicler<65> sugli
							 | 
						|||
| 
								 | 
							
														indici 0,2,4, ecc. Se step <20> negativo il ciclo proceder<65>
							 | 
						|||
| 
								 | 
							
														sull'array all'indietro.</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>max</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>intero</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>no</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>nessuno</emphasis></entry>
							 | 
						|||
| 
								 | 
							
														<entry>Massimo numero di cicli per la sezione.</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>show</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>booleano</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>no</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>true</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Stabilisce se mostrare o no la sezione</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                </tbody>
							 | 
						|||
| 
								 | 
							
								                </tgroup>
							 | 
						|||
| 
								 | 
							
								            </informaltable>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
									    Le sezioni sono usate per ciclare su array di dati. Tutti i tag
							 | 
						|||
| 
								 | 
							
								            <emphasis>section</emphasis> devono essere chiusi con
							 | 
						|||
| 
								 | 
							
								            <emphasis>/section</emphasis>. I parametri obbligatori sono
							 | 
						|||
| 
								 | 
							
								            <emphasis>name</emphasis> e <emphasis>loop</emphasis>. Il nome
							 | 
						|||
| 
								 | 
							
								            della sezione pu<70> essere quello che preferite, formato da lettere,
							 | 
						|||
| 
								 | 
							
								            numeri e underscore. Le sezioni possono essere nidificate, ed i nomi
							 | 
						|||
| 
								 | 
							
								            delle sezioni nidificate devono essere diversi fra loro. La variabile
							 | 
						|||
| 
								 | 
							
								            loop (di solito un array di valori) determina quante volte sar<61>
							 | 
						|||
| 
								 | 
							
								            eseguito il ciclo. Quando stampate una variabile all'interno di una
							 | 
						|||
| 
								 | 
							
								            sezione, il nome della sezione deve essere indicato a fianco del
							 | 
						|||
| 
								 | 
							
								            nome della variabile fra parentesi quadre [].
							 | 
						|||
| 
								 | 
							
								            <emphasis>sectionelse</emphasis> viene eseguito quando non ci sono 
							 | 
						|||
| 
								 | 
							
								            valori nella variabile loop.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>section</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								{* questo esempio stamper<65> tutti i valori dell'array $custid *}
							 | 
						|||
| 
								 | 
							
								{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
								{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								id: 1000<br>
							 | 
						|||
| 
								 | 
							
								id: 1001<br>
							 | 
						|||
| 
								 | 
							
								id: 1002<br></programlisting>
							 | 
						|||
| 
								 | 
							
								</example>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>variabile loop</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								{* la variabile loop determina soltanto il numero di cicli da ripetere.
							 | 
						|||
| 
								 | 
							
								   Potete accedere a qualsiasi variabile dal template della sezione.
							 | 
						|||
| 
								 | 
							
								   In questo esempio presumiamo che $custid, $name e $address siano
							 | 
						|||
| 
								 | 
							
								   tutti array contenenti lo stesso numero di valori *}
							 | 
						|||
| 
								 | 
							
								{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									name: {$name[customer]}<br>
							 | 
						|||
| 
								 | 
							
									address: {$address[customer]}<br>
							 | 
						|||
| 
								 | 
							
									<p>
							 | 
						|||
| 
								 | 
							
								{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								id: 1000<br>
							 | 
						|||
| 
								 | 
							
								name: John Smith<br>
							 | 
						|||
| 
								 | 
							
								address: 253 N 45th<br>
							 | 
						|||
| 
								 | 
							
								<p>
							 | 
						|||
| 
								 | 
							
								id: 1001<br>
							 | 
						|||
| 
								 | 
							
								name: Jack Jones<br>
							 | 
						|||
| 
								 | 
							
								address: 417 Mulberry ln<br>
							 | 
						|||
| 
								 | 
							
								<p>
							 | 
						|||
| 
								 | 
							
								id: 1002<br>
							 | 
						|||
| 
								 | 
							
								name: Jane Munson<br>
							 | 
						|||
| 
								 | 
							
								address: 5605 apple st<br>
							 | 
						|||
| 
								 | 
							
								<p></programlisting>
							 | 
						|||
| 
								 | 
							
								</example>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>nomi delle sezioni</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								{* come nome della sezione potete usare quello che preferite,
							 | 
						|||
| 
								 | 
							
								   e viene usato per riferirsi ai dati all'interno della sezione *}
							 | 
						|||
| 
								 | 
							
								{section name=mydata loop=$custid}
							 | 
						|||
| 
								 | 
							
									id: {$custid[mydata]}<br>
							 | 
						|||
| 
								 | 
							
									name: {$name[mydata]}<br>
							 | 
						|||
| 
								 | 
							
									address: {$address[mydata]}<br>
							 | 
						|||
| 
								 | 
							
									<p>
							 | 
						|||
| 
								 | 
							
								{/section}</programlisting>
							 | 
						|||
| 
								 | 
							
								</example>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>sezioni nidificate</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								{* le sezioni possono essere nidificate a qualsiasi profondit<69>. Con
							 | 
						|||
| 
								 | 
							
								   le sezioni nidificate potete accedere a strutture di dati complesse,
							 | 
						|||
| 
								 | 
							
								   ad esempio array multidimensionali. In questo esempio, $contact_type[customer]
							 | 
						|||
| 
								 | 
							
								   <20> un array di tipi di contatto per il cliente corrente. *}
							 | 
						|||
| 
								 | 
							
								{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									name: {$name[customer]}<br>
							 | 
						|||
| 
								 | 
							
									address: {$address[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{section name=contact loop=$contact_type[customer]}
							 | 
						|||
| 
								 | 
							
										{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br>
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
									<p>
							 | 
						|||
| 
								 | 
							
								{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								id: 1000<br>
							 | 
						|||
| 
								 | 
							
								name: John Smith<br>
							 | 
						|||
| 
								 | 
							
								address: 253 N 45th<br>
							 | 
						|||
| 
								 | 
							
								home phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								cell phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								e-mail: john@myexample.com<br>
							 | 
						|||
| 
								 | 
							
								<p>
							 | 
						|||
| 
								 | 
							
								id: 1001<br>
							 | 
						|||
| 
								 | 
							
								name: Jack Jones<br>
							 | 
						|||
| 
								 | 
							
								address: 417 Mulberry ln<br>
							 | 
						|||
| 
								 | 
							
								home phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								cell phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								e-mail: jack@myexample.com<br>
							 | 
						|||
| 
								 | 
							
								<p>
							 | 
						|||
| 
								 | 
							
								id: 1002<br>
							 | 
						|||
| 
								 | 
							
								name: Jane Munson<br>
							 | 
						|||
| 
								 | 
							
								address: 5605 apple st<br>
							 | 
						|||
| 
								 | 
							
								home phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								cell phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								e-mail: jane@myexample.com<br>
							 | 
						|||
| 
								 | 
							
								<p></programlisting>
							 | 
						|||
| 
								 | 
							
								</example>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>sezioni e array associativi</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								{* questo <20> un esempio di stampa di un array associativo
							 | 
						|||
| 
								 | 
							
								   di dati in una sezione *}
							 | 
						|||
| 
								 | 
							
								{section name=customer loop=$contacts}
							 | 
						|||
| 
								 | 
							
									name: {$contacts[customer].name}<br>
							 | 
						|||
| 
								 | 
							
									home: {$contacts[customer].home}<br>
							 | 
						|||
| 
								 | 
							
									cell: {$contacts[customer].cell}<br>
							 | 
						|||
| 
								 | 
							
									e-mail: {$contacts[customer].email}<p>
							 | 
						|||
| 
								 | 
							
								{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								name: John Smith<br>
							 | 
						|||
| 
								 | 
							
								home: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								cell: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								e-mail: john@myexample.com<p>
							 | 
						|||
| 
								 | 
							
								name: Jack Jones<br>
							 | 
						|||
| 
								 | 
							
								home phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								cell phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								e-mail: jack@myexample.com<p>
							 | 
						|||
| 
								 | 
							
								name: Jane Munson<br>
							 | 
						|||
| 
								 | 
							
								home phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								cell phone: 555-555-5555<br>
							 | 
						|||
| 
								 | 
							
								e-mail: jane@myexample.com<p></programlisting>
							 | 
						|||
| 
								 | 
							
								</example>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>sectionelse</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								{* sectionelse viene eseguito se non ci sono valori in $custid *}
							 | 
						|||
| 
								 | 
							
								{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
								{sectionelse}
							 | 
						|||
| 
								 | 
							
									there are no values in $custid.
							 | 
						|||
| 
								 | 
							
								{/section}</programlisting>
							 | 
						|||
| 
								 | 
							
								</example>
							 | 
						|||
| 
								 | 
							
										<para>
							 | 
						|||
| 
								 | 
							
										Le sezioni hanno anche le proprie variabili di gestione delle propriet<65>.
							 | 
						|||
| 
								 | 
							
										Vengono indicate cos<6F>: {$smarty.section.nomesezione.nomevariabile}
							 | 
						|||
| 
								 | 
							
										</para>
							 | 
						|||
| 
								 | 
							
										<note>
							 | 
						|||
| 
								 | 
							
										 <para>
							 | 
						|||
| 
								 | 
							
										  A partire da Smarty 1.5.0, la sintassi per le variabili delle propriet<65>
							 | 
						|||
| 
								 | 
							
										  di sessione <20> cambiata da {%nomesezione.nomevariabile%} a
							 | 
						|||
| 
								 | 
							
										  {$smarty.section.sectionname.varname}. La vecchia sintassi <20> ancora
							 | 
						|||
| 
								 | 
							
										  supportata, ma negli esempi del manuale troverete solo riferimenti
							 | 
						|||
| 
								 | 
							
										  alla nuova.
							 | 
						|||
| 
								 | 
							
										 </para>
							 | 
						|||
| 
								 | 
							
										</note>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.index">
							 | 
						|||
| 
								 | 
							
											<title>index</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											index si usa per visualizzare l'attuale indice del ciclo, partendo
							 | 
						|||
| 
								 | 
							
											da zero (o dall'attributo start se presente), e con incrementi di uno
							 | 
						|||
| 
								 | 
							
											(o dell'attributo step se presente).
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
											<note>
							 | 
						|||
| 
								 | 
							
												<title>Nota tecnica</title>
							 | 
						|||
| 
								 | 
							
												<para>
							 | 
						|||
| 
								 | 
							
												Se le propriet<65> step e start non vengono modificate, index
							 | 
						|||
| 
								 | 
							
												funziona allo stesso modo della propriet<65> iteration, ad 
							 | 
						|||
| 
								 | 
							
												eccezione del fatto che parte da 0 invece che da 1.
							 | 
						|||
| 
								 | 
							
												</para>
							 | 
						|||
| 
								 | 
							
											</note>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> index</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.index} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									0 id: 1000<br>
							 | 
						|||
| 
								 | 
							
									1 id: 1001<br>
							 | 
						|||
| 
								 | 
							
									2 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.index.prev">
							 | 
						|||
| 
								 | 
							
											<title>index_prev</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											index_prev visualizza l'indice del ciclo precedente.
							 | 
						|||
| 
								 | 
							
											Sul primo ciclo <20> impostata a -1.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> index_prev</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.index} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{* nota: $custid[customer.index] e $custid[customer] hanno identico significato *}
							 | 
						|||
| 
								 | 
							
									{if $custid[customer.index_prev] ne $custid[customer.index]}
							 | 
						|||
| 
								 | 
							
								    	The customer id changed<br>
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									0 id: 1000<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id changed<br>
							 | 
						|||
| 
								 | 
							
									1 id: 1001<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id changed<br>
							 | 
						|||
| 
								 | 
							
									2 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id changed<br>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.index.next">
							 | 
						|||
| 
								 | 
							
											<title>index_next</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
										index_next visualizza l'indice del prossimo ciclo. Sull'ultimo
							 | 
						|||
| 
								 | 
							
										ciclo ha sempre il valore maggiore dell'attuale (rispettando
							 | 
						|||
| 
								 | 
							
										l'attributo step, quando presente).
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> index_next</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.index} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{* nota: $custid[customer.index] e $custid[customer] hanno identico significato *}
							 | 
						|||
| 
								 | 
							
									{if $custid[customer.index_next] ne $custid[customer.index]}
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									0 id: 1000<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
									1 id: 1001<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
									2 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.iteration">
							 | 
						|||
| 
								 | 
							
											<title>iteration</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											iteration visualizza l'iterazione attuale del ciclo.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
											<note>
							 | 
						|||
| 
								 | 
							
											 <para>
							 | 
						|||
| 
								 | 
							
											  Al contrario di index, questa propriet<65> non <20> influenzata dalle
							 | 
						|||
| 
								 | 
							
								                          propriet<65> start, step e max. Inoltre iteration comincia da 1
							 | 
						|||
| 
								 | 
							
								                          invece che da 0 come index. rownum <20> un alias di iteration, e
							 | 
						|||
| 
								 | 
							
								                          funziona in modo identico.
							 | 
						|||
| 
								 | 
							
											 </para>
							 | 
						|||
| 
								 | 
							
											</note>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> iteration</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid start=5 step=2}
							 | 
						|||
| 
								 | 
							
									current loop iteration: {$smarty.section.customer.iteration}<br>
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.index} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{* nota: $custid[customer.index] e $custid[customer] hanno identico significato *}
							 | 
						|||
| 
								 | 
							
									{if $custid[customer.index_next] ne $custid[customer.index]}
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									current loop iteration: 1
							 | 
						|||
| 
								 | 
							
									5 id: 1000<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
									current loop iteration: 2
							 | 
						|||
| 
								 | 
							
									7 id: 1001<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
									current loop iteration: 3
							 | 
						|||
| 
								 | 
							
									9 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								    	The customer id will change<br>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.first">
							 | 
						|||
| 
								 | 
							
											<title>first</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
										first vale true se l'iterazione attuale <20> la prima.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> first</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									{if $smarty.section.customer.first}
							 | 
						|||
| 
								 | 
							
								    	<table>
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									<tr><td>{$smarty.section.customer.index} id:
							 | 
						|||
| 
								 | 
							
								        	{$custid[customer]}</td></tr>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									{if $smarty.section.customer.last}
							 | 
						|||
| 
								 | 
							
								    	</table>
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									<table>
							 | 
						|||
| 
								 | 
							
									<tr><td>0 id: 1000</td></tr>
							 | 
						|||
| 
								 | 
							
									<tr><td>1 id: 1001</td></tr>
							 | 
						|||
| 
								 | 
							
									<tr><td>2 id: 1002</td></tr>
							 | 
						|||
| 
								 | 
							
									</table>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.last">
							 | 
						|||
| 
								 | 
							
											<title>last</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
										last vale true se l'attuale iterazione <20> l'ultima.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> last</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									{if $smarty.section.customer.first}
							 | 
						|||
| 
								 | 
							
								    	<table>
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									<tr><td>{$smarty.section.customer.index} id:
							 | 
						|||
| 
								 | 
							
								        	{$custid[customer]}</td></tr>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									{if $smarty.section.customer.last}
							 | 
						|||
| 
								 | 
							
								    	</table>
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									<table>
							 | 
						|||
| 
								 | 
							
									<tr><td>0 id: 1000</td></tr>
							 | 
						|||
| 
								 | 
							
									<tr><td>1 id: 1001</td></tr>
							 | 
						|||
| 
								 | 
							
									<tr><td>2 id: 1002</td></tr>
							 | 
						|||
| 
								 | 
							
									</table>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.rownum">
							 | 
						|||
| 
								 | 
							
											<title>rownum</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											rownum visualizza l'iterazione attuale del ciclo, partendo
							 | 
						|||
| 
								 | 
							
											da uno. E' un alias di iteration, e funziona in modo identico.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> rownum</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.rownum} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									1 id: 1000<br>
							 | 
						|||
| 
								 | 
							
									2 id: 1001<br>
							 | 
						|||
| 
								 | 
							
									3 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.loop">
							 | 
						|||
| 
								 | 
							
											<title>loop</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											loop visualizza l'index dell'ultimo ciclo visualizzato dalla
							 | 
						|||
| 
								 | 
							
											sezione. Pu<50> essere usato all'interno o dopo la sezione.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> index</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid}
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.index} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									There were {$smarty.section.customer.loop} customers shown above.
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									0 id: 1000<br>
							 | 
						|||
| 
								 | 
							
									1 id: 1001<br>
							 | 
						|||
| 
								 | 
							
									2 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									There were 3 customers shown above.
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.show">
							 | 
						|||
| 
								 | 
							
											<title>show</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
								        	<emphasis>show</emphasis> <20> usato come parametro per la sezione.
							 | 
						|||
| 
								 | 
							
								        	<emphasis>show</emphasis> <20> un valore booleano, true o false. Se
							 | 
						|||
| 
								 | 
							
								        	false, la sezione non verr<72> visualizzata. Se <20> presente un sectionelse,
							 | 
						|||
| 
								 | 
							
								        	verr<72> visualizzato questo.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>attributo show</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{* $show_customer_info potrebbe essere stato passato dall'applicazione
							 | 
						|||
| 
								 | 
							
								        PHP, per stabilire se questa sezione deve essere visualizzata o no *}
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid show=$show_customer_info}
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.rownum} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									{if $smarty.section.customer.show}
							 | 
						|||
| 
								 | 
							
									the section was shown.
							 | 
						|||
| 
								 | 
							
									{else}
							 | 
						|||
| 
								 | 
							
									the section was not shown.
							 | 
						|||
| 
								 | 
							
									{/if}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									1 id: 1000<br>
							 | 
						|||
| 
								 | 
							
									2 id: 1001<br>
							 | 
						|||
| 
								 | 
							
									3 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									the section was shown.
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
											<sect2 id="section.property.total">
							 | 
						|||
| 
								 | 
							
											<title>total</title>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											total visualizza il numero totale di iterazioni che la sezione
							 | 
						|||
| 
								 | 
							
											eseguir<69>. Pu<50> essere usato all'interno o dopo la sezione.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
									<example>
							 | 
						|||
| 
								 | 
							
									<title>propriet<EFBFBD> total</title>
							 | 
						|||
| 
								 | 
							
									<programlisting>
							 | 
						|||
| 
								 | 
							
									{section name=customer loop=$custid step=2}
							 | 
						|||
| 
								 | 
							
									{$smarty.section.customer.index} id: {$custid[customer]}<br>
							 | 
						|||
| 
								 | 
							
									{/section}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									There were {$smarty.section.customer.total} customers shown above.
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									OUTPUT:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									0 id: 1000<br>
							 | 
						|||
| 
								 | 
							
									2 id: 1001<br>
							 | 
						|||
| 
								 | 
							
									4 id: 1002<br>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									There were 3 customers shown above.
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
									</example>
							 | 
						|||
| 
								 | 
							
											</sect2>
							 | 
						|||
| 
								 | 
							
								</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
							 | 
						|||
| 
								 | 
							
								-->
							 |