mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-03 22:01:36 +01:00 
			
		
		
		
	
		
			
	
	
		
			106 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
		
		
			
		
	
	
			106 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| 
								 | 
							
								<?xml version="1.0" encoding="iso-8859-1"?>
							 | 
						|||
| 
								 | 
							
								<!-- $Revision$ -->
							 | 
						|||
| 
								 | 
							
								     <sect1 id="language.function.capture">
							 | 
						|||
| 
								 | 
							
								      <title>capture</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>no</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>default</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Nome del blocco catturato</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>assign</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>stringa</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>no</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>nessuno</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Nome della variabile cui assegnare l'output catturato</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                </tbody>
							 | 
						|||
| 
								 | 
							
								                </tgroup>
							 | 
						|||
| 
								 | 
							
								            </informaltable>
							 | 
						|||
| 
								 | 
							
								      <para>
							 | 
						|||
| 
								 | 
							
								       capture si usa per intercettare l'output del template assegnandolo
							 | 
						|||
| 
								 | 
							
								       ad una variabile invece di visualizzarlo. Qualsiasi contenuto compreso
							 | 
						|||
| 
								 | 
							
								       fra {capture name="foo"} e {/capture} viene aggiunto alla variabile
							 | 
						|||
| 
								 | 
							
								       specificata nell'attributo name. Il contenuto catturato pu<70> essere
							 | 
						|||
| 
								 | 
							
								       usato nel template utilizzando la variabile speciale $smarty.capture.foo
							 | 
						|||
| 
								 | 
							
								       dove foo <20> il nome passato nell'attributo name. Se non fornite un
							 | 
						|||
| 
								 | 
							
								       attributo name, verr<72> usato "default". Tutti i comandi {capture}
							 | 
						|||
| 
								 | 
							
								       devono essere chiusi con {/capture}. E' possibile nidificarli.
							 | 
						|||
| 
								 | 
							
								      </para>
							 | 
						|||
| 
								 | 
							
									  <note>
							 | 
						|||
| 
								 | 
							
									  <title>Nota tecnica</title>
							 | 
						|||
| 
								 | 
							
								      <para>
							 | 
						|||
| 
								 | 
							
								       Le versioni da 1.4.0 a 1.4.4 di Smarty mettevano il contenuto catturato
							 | 
						|||
| 
								 | 
							
								       nella variabile $return. A partire dalla 1.4.5 si utilizza l'attributo
							 | 
						|||
| 
								 | 
							
								       name, quindi modificate i vostri template di conseguenza.
							 | 
						|||
| 
								 | 
							
								      </para>
							 | 
						|||
| 
								 | 
							
									  </note>
							 | 
						|||
| 
								 | 
							
								      <caution>
							 | 
						|||
| 
								 | 
							
								       <para>
							 | 
						|||
| 
								 | 
							
								        Fate attenzione se catturate l'output di <command>insert</command>.
							 | 
						|||
| 
								 | 
							
								        Se avete il caching attivato e usate comandi <command>insert</command>
							 | 
						|||
| 
								 | 
							
								        che vi aspettate vengano eseguiti nel contenuto in cache, non
							 | 
						|||
| 
								 | 
							
								        catturate questo contenuto.
							 | 
						|||
| 
								 | 
							
								       </para>
							 | 
						|||
| 
								 | 
							
								      </caution>
							 | 
						|||
| 
								 | 
							
								      <para>
							 | 
						|||
| 
								 | 
							
								       <example>
							 | 
						|||
| 
								 | 
							
								        <title>catturare il contenuto del template</title>
							 | 
						|||
| 
								 | 
							
								        <programlisting>
							 | 
						|||
| 
								 | 
							
								<![CDATA[
							 | 
						|||
| 
								 | 
							
								{* vogliamo stampare la riga di tabella solo se c'<27> del contenuto *}
							 | 
						|||
| 
								 | 
							
								{capture name=banner}
							 | 
						|||
| 
								 | 
							
								{include file="get_banner.tpl"}
							 | 
						|||
| 
								 | 
							
								{/capture}
							 | 
						|||
| 
								 | 
							
								{if $smarty.capture.banner ne ""}
							 | 
						|||
| 
								 | 
							
									<tr>
							 | 
						|||
| 
								 | 
							
										<td>
							 | 
						|||
| 
								 | 
							
											{$smarty.capture.banner}
							 | 
						|||
| 
								 | 
							
										</td>
							 | 
						|||
| 
								 | 
							
									</tr>
							 | 
						|||
| 
								 | 
							
								{/if}
							 | 
						|||
| 
								 | 
							
								]]>
							 | 
						|||
| 
								 | 
							
								</programlisting>
							 | 
						|||
| 
								 | 
							
								       </example>
							 | 
						|||
| 
								 | 
							
								      </para>
							 | 
						|||
| 
								 | 
							
								</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
							 | 
						|||
| 
								 | 
							
								-->
							 |