mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-04 06:11:37 +01:00 
			
		
		
		
	
		
			
	
	
		
			154 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
		
		
			
		
	
	
			154 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| 
								 | 
							
								<?xml version="1.0" encoding="iso-8859-1"?>
							 | 
						|||
| 
								 | 
							
								<!-- $Revision$ -->
							 | 
						|||
| 
								 | 
							
										<sect1 id="language.function.html.options">
							 | 
						|||
| 
								 | 
							
											<title>html_options</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>values</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>array</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Oui, <20> moins que vous n'utilisiez
							 | 
						|||
| 
								 | 
							
								                        l'attribut options</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>n/a</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>un tableau de valeurs pour les listes
							 | 
						|||
| 
								 | 
							
								                        d<>roulantes</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>output</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>array</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Oui, <20> moins que vous n'utilisiez
							 | 
						|||
| 
								 | 
							
								                        l'attribut options</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>n/a</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Un tableau de libell<6C>s pour la liste
							 | 
						|||
| 
								 | 
							
								                        d<>roulante</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>selected</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>cha<EFBFBD>ne de caract<63>res/tableau</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Non</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>empty</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Les <20>l<EFBFBD>ments s<>lectionn<6E>s</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>options</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Tableau associatif</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Oui, <20> moins que vous n'utilisiez option
							 | 
						|||
| 
								 | 
							
								                        et values</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>n/a</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Un tableau associatif valeur / libell<6C></entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                    <row>
							 | 
						|||
| 
								 | 
							
								                        <entry>name</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>cha<EFBFBD>ne de caract<63>res</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Non</entry>
							 | 
						|||
| 
								 | 
							
								                        <entry><emphasis>empty</emphasis></entry>
							 | 
						|||
| 
								 | 
							
								                        <entry>Nom du goupe d'options</entry>
							 | 
						|||
| 
								 | 
							
								                    </row>
							 | 
						|||
| 
								 | 
							
								                </tbody>
							 | 
						|||
| 
								 | 
							
								                </tgroup>
							 | 
						|||
| 
								 | 
							
								            </informaltable>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											html_options est une fonction utilisateur qui cr<63>e un groupe d'options
							 | 
						|||
| 
								 | 
							
											avec les donn<6E>es fournies. Elle prend en charge les <20>l<EFBFBD>ments
							 | 
						|||
| 
								 | 
							
											s<>lectionn<6E>s par d<>faut. Les attributs requis sont values et output,
							 | 
						|||
| 
								 | 
							
											<09> moins que vous n'utilisiez options <20> la place.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											Si la valeur donn<6E>e est un tableau, elle sera trait<69>e comme un
							 | 
						|||
| 
								 | 
							
								         OPTGROUP html, et affich<63>e. La r<>cursivit<69> est support<72>e avec
							 | 
						|||
| 
								 | 
							
								         OPTGROUP. La sortie est compatible XHTML.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											Si l'attribut optionnel <emphasis>name</emphasis> est donn<6E>, les
							 | 
						|||
| 
								 | 
							
								         balises <select name="groupname"></select> entoureront la
							 | 
						|||
| 
								 | 
							
								         liste d'options.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
											<para>
							 | 
						|||
| 
								 | 
							
											Tous les param<61>tres qui ne sont pas dans la liste ci-dessus sont
							 | 
						|||
| 
								 | 
							
								         affich<63>s en tant que paires nom / valeur. Ils sont ignor<6F>s si
							 | 
						|||
| 
								 | 
							
								         le param<61>tre optionnel <emphasis>name</emphasis> n'est pas donn<6E>.
							 | 
						|||
| 
								 | 
							
											</para>
							 | 
						|||
| 
								 | 
							
								<example>
							 | 
						|||
| 
								 | 
							
								<title>html_options</title>
							 | 
						|||
| 
								 | 
							
								<programlisting>
							 | 
						|||
| 
								 | 
							
								index.php:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								require('Smarty.class.php');
							 | 
						|||
| 
								 | 
							
								$smarty = new Smarty;
							 | 
						|||
| 
								 | 
							
								$smarty->assign('id_client', array(1000,1001,1002,1003));
							 | 
						|||
| 
								 | 
							
								$smarty->assign('nom_client', array('Joe Schmoe','Jack Smith','Jane
							 | 
						|||
| 
								 | 
							
								Johnson','Charlie Brown'));
							 | 
						|||
| 
								 | 
							
								$smarty->assign('client_id', 1001);
							 | 
						|||
| 
								 | 
							
								$smarty->display('index.tpl');
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								index.tpl:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<select name=client_id>
							 | 
						|||
| 
								 | 
							
									{html_options values=$id_client selected=$client_id output=$nom_client}
							 | 
						|||
| 
								 | 
							
								</select>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								index.php:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								require('Smarty.class.php');
							 | 
						|||
| 
								 | 
							
								$smarty = new Smarty;
							 | 
						|||
| 
								 | 
							
								$smarty->assign('cust_options', array(
							 | 
						|||
| 
								 | 
							
											1001 => 'Joe Schmoe',
							 | 
						|||
| 
								 | 
							
											1002 => 'Jack Smith',
							 | 
						|||
| 
								 | 
							
											1003 => 'Jane Johnson',
							 | 
						|||
| 
								 | 
							
											1004 => 'Charlie Brown'));
							 | 
						|||
| 
								 | 
							
								$smarty->assign('client_id', 1001);
							 | 
						|||
| 
								 | 
							
								$smarty->display('index.tpl');
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								index.tpl:
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<select name=client_id>
							 | 
						|||
| 
								 | 
							
									{html_options options=$cust_options selected=$client_id}
							 | 
						|||
| 
								 | 
							
								</select>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								SORTIE: (valable pour les deux exemples)
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<select name=client_id>
							 | 
						|||
| 
								 | 
							
									<option value="1000">Joe Schmoe</option>
							 | 
						|||
| 
								 | 
							
									<option value="1001" selected="selected">Jack Smith</option>
							 | 
						|||
| 
								 | 
							
									<option value="1002">Jane Johnson</option>
							 | 
						|||
| 
								 | 
							
									<option value="1003">Charlie Brown</option>
							 | 
						|||
| 
								 | 
							
								</select></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
							 | 
						|||
| 
								 | 
							
								-->
							 |