mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-10-31 04:11:37 +01:00 
			
		
		
		
	
		
			
	
	
		
			121 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
		
		
			
		
	
	
			121 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
|   | <?xml version="1.0" encoding="iso-8859-1"?> | |||
|  | <!-- $Revision$ --> | |||
|  | 		<sect1 id="language.function.eval"> | |||
|  | 			<title>eval</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>var</entry> | |||
|  |                         <entry>misto</entry> | |||
|  |                         <entry>s<EFBFBD></entry> | |||
|  |                         <entry><emphasis>nessuno</emphasis></entry> | |||
|  |                         <entry>variabile (o stringa) da valorizzare</entry> | |||
|  |                     </row> | |||
|  |                     <row> | |||
|  |                         <entry>assign</entry> | |||
|  |                         <entry>stringa</entry> | |||
|  |                         <entry>no</entry> | |||
|  |                         <entry><emphasis>nessuno</emphasis></entry> | |||
|  |                         <entry>la variabile cui verr<72> assegnato l'output</entry> | |||
|  |                     </row> | |||
|  |                 </tbody> | |||
|  |                 </tgroup> | |||
|  |             </informaltable> | |||
|  | 			<para> | |||
|  | 			eval si usa per valorizzare una variabile come se fosse un | |||
|  | 			template. Si pu<70> usare per incorporare tag o variabili di template | |||
|  | 			dentro altre variabili, oppure tag o variabili nelle variabili dei | |||
|  | 			file di configurazione. | |||
|  | 			</para> | |||
|  | 			<para> | |||
|  | 			Se fornite lo speciale attributo "assign" l'output della funzione | |||
|  | 			eval sar<61> assegnato a questa variabile invece di essere stampato | |||
|  | 			in output. | |||
|  | 			</para> | |||
|  | 			<note> | |||
|  | 			<title>Nota tecnica</title> | |||
|  | 			<para> | |||
|  | 			La variabili valorizzate con eval sono trattate allo stesso modo | |||
|  | 			dei template. Seguono le stesse regole di escape e di sicurezza, | |||
|  | 			come se fossero template | |||
|  | 			</para> | |||
|  | 			</note> | |||
|  | 			<note> | |||
|  | 			<title>Nota tecnica</title> | |||
|  | 			<para> | |||
|  | 			Le variabili valorizzate con eval vengono compilate ad ogni chiamata: | |||
|  | 			la versione compilata non viene salvata! Comunque, se avete il | |||
|  | 			caching abilitato, l'output verr<72> messo in cache con il resto del | |||
|  | 			template. | |||
|  | 			</para> | |||
|  | 			</note> | |||
|  | <example> | |||
|  | <title>eval</title> | |||
|  | <programlisting> | |||
|  | setup.conf | |||
|  | ---------- | |||
|  | 
 | |||
|  | emphstart = <b> | |||
|  | emphend = </b> | |||
|  | title = Welcome to {$company}'s home page! | |||
|  | ErrorCity = You must supply a {#emphstart#}city{#emphend#}. | |||
|  | ErrorState = You must supply a {#emphstart#}state{#emphend#}. | |||
|  | 
 | |||
|  | 
 | |||
|  | index.tpl | |||
|  | --------- | |||
|  | 
 | |||
|  | {config_load file="setup.conf"} | |||
|  | 
 | |||
|  | {eval var=$foo} | |||
|  | {eval var=#title#} | |||
|  | {eval var=#ErrorCity#} | |||
|  | {eval var=#ErrorState# assign="state_error"} | |||
|  | {$state_error} | |||
|  | 
 | |||
|  | OUTPUT: | |||
|  | 
 | |||
|  | This is the contents of foo. | |||
|  | Welcome to Foobar Pub & Grill's home page! | |||
|  | You must supply a <b>city</b>. | |||
|  | You must supply a <b>state</b>. | |||
|  | 
 | |||
|  | </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 | |||
|  | --> |