mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-04 06:11:37 +01:00 
			
		
		
		
	
		
			
	
	
		
			136 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
		
		
			
		
	
	
			136 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| 
								 | 
							
								<?xml version="1.0" encoding="iso-8859-1"?>
							 | 
						|||
| 
								 | 
							
								<!-- $Revision$ -->
							 | 
						|||
| 
								 | 
							
										<sect1 id="language.function.html.table">
							 | 
						|||
| 
								 | 
							
											<title>html_table</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>loop</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>array</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Oui</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>n/a</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Tableau de donn<6E>es <20> parcourir</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>cols</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>integer</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Non</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>3</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Nombre de colonnes du tableau</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>table_attr</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>cha<EFBFBD>ne de caract<63>res</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Non</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>border="1"</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>attributs pour la balise table</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>tr_attr</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>cha<EFBFBD>ne de caract<63>res</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Non</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>empty</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>attributs pour les balises tr (les tableaux sont
							 | 
						|||
| 
								 | 
							
								                        parcourus)</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>td_attr</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>cha<EFBFBD>ne de caract<63>res</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Non</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>empty</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>attributs pour les balises td (les tableaux sont
							 | 
						|||
| 
								 | 
							
								                        parcourus)</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>trailpad</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>cha<EFBFBD>ne de caract<63>res</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Non</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>&nbsp;</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>valeur avec laquelle remplir les cellules
							 | 
						|||
| 
								 | 
							
								                        restantes de la derni<6E>re ligne (si il y en a)</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                </tbody>
							 | 
						|||
| 
								 | 
							
								                </tgroup>
							 | 
						|||
| 
								 | 
							
								            </informaltable>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											<emphasis>html_table</emphasis> est une fonction utilisateur
							 | 
						|||
| 
								 | 
							
								         qui transforme un tableau de donn<6E>es dans un tabeau HTML. L'attribut
							 | 
						|||
| 
								 | 
							
								         <emphasis>cols</emphasis> d<>termine le nombre de colonne du tableau.
							 | 
						|||
| 
								 | 
							
								         Les attributs <emphasis>table_attr</emphasis>, <emphasis>tr_attr</emphasis>
							 | 
						|||
| 
								 | 
							
								         et <emphasis>td_attr</emphasis> d<>terminent les attributs donn<6E>s aux
							 | 
						|||
| 
								 | 
							
								         balises table, tr et td. Si <emphasis>tr_attr</emphasis> ou
							 | 
						|||
| 
								 | 
							
											<emphasis>td_attr</emphasis> sont des tableaux, ils seront parcourus.
							 | 
						|||
| 
								 | 
							
											<emphasis>trailpad</emphasis> est la valeur avec laquelle remplir
							 | 
						|||
| 
								 | 
							
								         les cellules restantes de la derni<6E>re ligne, s'il y en a une.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>html_table</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								index.php:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								require('Smarty.class.php');
							 | 
						|||
| 
								 | 
							
								$smarty = new Smarty;
							 | 
						|||
| 
								 | 
							
								$smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
							 | 
						|||
| 
								 | 
							
								$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"'));
							 | 
						|||
| 
								 | 
							
								$smarty->display('index.tpl');
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								index.tpl:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								{html_table loop=$data}
							 | 
						|||
| 
								 | 
							
								{html_table loop=$data cols=4 table_attr='border="0"'}
							 | 
						|||
| 
								 | 
							
								{html_table loop=$data cols=4 tr_attr=$tr}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								SORTIE:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<table border="1">
							 | 
						|||
| 
								 | 
							
								<tr><td>1</td><td>2</td><td>3</td></tr>
							 | 
						|||
| 
								 | 
							
								<tr><td>4</td><td>5</td><td>6</td></tr>
							 | 
						|||
| 
								 | 
							
								<tr><td>7</td><td>8</td><td>9</td></tr>
							 | 
						|||
| 
								 | 
							
								</table>
							 | 
						|||
| 
								 | 
							
								<table border="0">
							 | 
						|||
| 
								 | 
							
								<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
							 | 
						|||
| 
								 | 
							
								<tr><td>5</td><td>6</td><td>7</td><td>8</td></tr>
							 | 
						|||
| 
								 | 
							
								<tr><td>9</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
							 | 
						|||
| 
								 | 
							
								</table>
							 | 
						|||
| 
								 | 
							
								<table border="1">
							 | 
						|||
| 
								 | 
							
								<tr bgcolor="#eeeeee"><td>1</td><td>2</td><td>3</td><td>4</td></tr>
							 | 
						|||
| 
								 | 
							
								<tr bgcolor="#dddddd"><td>5</td><td>6</td><td>7</td><td>8</td></tr>
							 | 
						|||
| 
								 | 
							
								<tr bgcolor="#eeeeee"><td>9</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
							 | 
						|||
| 
								 | 
							
								</table></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
							 | 
						|||
| 
								 | 
							
								-->
							 |