mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-10-31 04:11:37 +01:00 
			
		
		
		
	
		
			
	
	
		
			134 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
		
		
			
		
	
	
			134 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
|   | <?xml version="1.0" encoding="iso-8859-1"?> | |||
|  | <!-- $Revision$ --> | |||
|  | 		<sect1 id="language.function.cycle"> | |||
|  | 			<title>cycle</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>Nom attribut</entry> | |||
|  |                         <entry>Type</entry> | |||
|  |                         <entry>Requis</entry> | |||
|  |                         <entry>Defaut</entry> | |||
|  |                         <entry>Description</entry> | |||
|  |                     </row> | |||
|  |                 </thead> | |||
|  |                 <tbody> | |||
|  |                     <row> | |||
|  |                         <entry>name</entry> | |||
|  |                         <entry>cha<EFBFBD>ne de caract<63>res</entry> | |||
|  |                         <entry>Non</entry> | |||
|  |                         <entry><emphasis>default</emphasis></entry> | |||
|  |                         <entry>Le nom du cycle</entry> | |||
|  |                     </row> | |||
|  |                     <row> | |||
|  |                         <entry>values</entry> | |||
|  |                         <entry>divers</entry> | |||
|  |                         <entry>Oui</entry> | |||
|  |                         <entry><emphasis>N/A</emphasis></entry> | |||
|  | 						<entry>Les valeurs sur lesquelles boucler, soit une liste | |||
|  |                   s<>par<61>e par des virgules, (voir l'attribut delimiter), | |||
|  |                   soit un tableau de valeurs.</entry> | |||
|  |                     </row> | |||
|  |                     <row> | |||
|  |                         <entry>print</entry> | |||
|  |                         <entry>bool<EFBFBD>en</entry> | |||
|  |                         <entry>Non</entry> | |||
|  |                         <entry><emphasis>true</emphasis></entry> | |||
|  |                         <entry>S'il faut afficher ou non cette valeur</entry> | |||
|  |                     </row> | |||
|  |                     <row> | |||
|  |                         <entry>advance</entry> | |||
|  |                         <entry>bool<EFBFBD>en</entry> | |||
|  |                         <entry>Non</entry> | |||
|  |                         <entry><emphasis>true</emphasis></entry> | |||
|  |                         <entry>Oui ou non aller <20> la procha<68>ne valeur</entry> | |||
|  |                     </row> | |||
|  |                     <row> | |||
|  |                         <entry>delimiter</entry> | |||
|  |                         <entry>cha<EFBFBD>ne de caract<63>res</entry> | |||
|  |                         <entry>Non</entry> | |||
|  |                         <entry><emphasis>,</emphasis></entry> | |||
|  |                         <entry>Le d<>limiteur <20> utiliser dans la liste.</entry> | |||
|  |                     </row> | |||
|  |                     <row> | |||
|  |                         <entry>assign</entry> | |||
|  |                         <entry>cha<EFBFBD>ne de caract<63>res</entry> | |||
|  |                         <entry>Non</entry> | |||
|  |                         <entry><emphasis>n/a</emphasis></entry> | |||
|  |                         <entry>La variable de template dans laquelle la sortie | |||
|  |                         sera assign<67>e</entry> | |||
|  |                     </row> | |||
|  |                 </tbody> | |||
|  |                 </tgroup> | |||
|  |             </informaltable> | |||
|  | 			<para> | |||
|  | 			cycle est utilis<69> pour boucler sur un ensemble de valeurs. Tr<54>s pratique | |||
|  |          pour alterner entre deux ou plusieurs couleurs dans un tableau, | |||
|  |          ou plus g<>n<EFBFBD>ralement pour boucler sur les valeurs d'un tableau. | |||
|  | 			</para> | |||
|  | 			<para> | |||
|  | 			Vous pouvez d<>finir plusieurs "cycle" dans votre template, en leur | |||
|  |          donnant des noms uniques (attribut name). | |||
|  | 			</para> | |||
|  | 			<para> | |||
|  | 			Vous pouvez emp<6D>cher la valeur courante de s'afficher en d<>finissant | |||
|  | 			l'attribut print <20> false. Ce proc<6F>d<EFBFBD> peut <20>tre utile pour discr<63>tement | |||
|  |          passer outre une valeur de la liste. | |||
|  | 			</para> | |||
|  | 			<para> | |||
|  | 			L'attribut advance est utilis<69> pour r<>p<EFBFBD>ter une valeur. Lorsque | |||
|  | 			d<>finit <20> false, le prochain appel de cycle ram<61>nera la m<>me valeur. | |||
|  | 			</para> | |||
|  | 			<para> | |||
|  | 			Si vous d<>finissez l'attribut sp<73>cial "assign", la sortie de la fonction | |||
|  |          cycle y sera assign<67>e plut<75>t que d'<27>tre directement affich<63>e. | |||
|  | 			</para> | |||
|  | <example> | |||
|  | <title>cycle</title> | |||
|  | <programlisting> | |||
|  | {section name=rows loop=$data} | |||
|  | <tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}"> | |||
|  |    <td>{$data[rows]}</td> | |||
|  | </tr> | |||
|  | {/section} | |||
|  | 
 | |||
|  | SORTIE: | |||
|  | 
 | |||
|  | <tr bgcolor="#eeeeee"> | |||
|  |    <td>1</td> | |||
|  | </tr> | |||
|  | <tr bgcolor="#d0d0d0"> | |||
|  |    <td>2</td> | |||
|  | </tr> | |||
|  | <tr bgcolor="#eeeeee"> | |||
|  |    <td>3</td> | |||
|  | </tr> | |||
|  | </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 | |||
|  | --> |