mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-03 22:01:36 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			109 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
<?xml version="1.0" encoding="iso-8859-1"?>
 | 
						|
<!-- $Revision$ -->
 | 
						|
		<sect1 id="language.function.html.options">
 | 
						|
			<title>html_options (Ausgabe von 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>Attribut Name</entry>
 | 
						|
                        <entry>Typ</entry>
 | 
						|
                        <entry>Erforderlich</entry>       
 | 
						|
                        <entry>Standardwert</entry>
 | 
						|
                        <entry>Beschreibung</entry>
 | 
						|
                    </row>
 | 
						|
                </thead>
 | 
						|
                <tbody>
 | 
						|
                    <row>
 | 
						|
                        <entry>values</entry>
 | 
						|
                        <entry>array</entry>
 | 
						|
                        <entry>Ja, ausser 'options'-Attribut wird verwendet.</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Array mit Werten für die dropdown-Liste.</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>output</entry>
 | 
						|
                        <entry>array</entry>
 | 
						|
                        <entry>Ja, ausser 'options'-Attribut wird verwendet.</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Arrays mit Namen für die dropdown-Liste.</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>selected</entry>
 | 
						|
                        <entry>string</entry>
 | 
						|
                        <entry>Nein</entry>
 | 
						|
                        <entry><emphasis>empty</emphasis></entry>
 | 
						|
                        <entry>Das ausgewählte Array Element.</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>options</entry>
 | 
						|
                        <entry>associative array</entry>
 | 
						|
                        <entry>Ja, ausser wenn das 'values'- und das 'output'-Attribut verwendet werden.</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Assoziatives Array mit Werten die ausgegeben werden sollen.</entry>
 | 
						|
                    </row>
 | 
						|
                </tbody>
 | 
						|
                </tgroup>
 | 
						|
            </informaltable>
 | 
						|
			<para>
 | 
						|
			'html_options' wird verwendet um HTML-Options Listen mit den übergebenen Daten
 | 
						|
			zu erzeugen. Die Funktion kümmert sich ebenfalls um das setzen des ausgewählten
 | 
						|
			Standardwertes. Die Attribute 'values' und 'output' sind erforderlich,
 | 
						|
			ausser man verwendet das Attribut 'options'. Wenn ein Wert als Array erkannt wird,
 | 
						|
			wird er als HTML-OPTGROUP ausgegeben und die Werte werden in Gruppen dargestellt.
 | 
						|
			Rekursion wird unterstützt. Die Ausgabe ist XHTML kompatibel.
 | 
						|
			</para>
 | 
						|
<example>
 | 
						|
<title>html_options</title>
 | 
						|
<programlisting>
 | 
						|
{* nehmen Sie an, dass $cust_ids und $cust_names Arrays mit Werten sind,
 | 
						|
   während $customer_id auch leer sein kann *}
 | 
						|
 | 
						|
<select name=customer_id>
 | 
						|
	{html_options values=$cust_ids selected=$customer_id output=$cust_names}
 | 
						|
</select>
 | 
						|
 | 
						|
 | 
						|
{* alternativ können die Werte aus 'values' und 'output' als assoziative Arrays
 | 
						|
   an 'options' übergeben werden. $customer_options ist in diesem Beispiel ein assoziatives Array *}
 | 
						|
 | 
						|
<select name=customer_id>
 | 
						|
	{html_options options=$customer_options selected=$customer_id}
 | 
						|
</select>
 | 
						|
 | 
						|
 | 
						|
AUSGABE:
 | 
						|
 | 
						|
<select name=customer_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
 | 
						|
--> |