Files
smarty/docs/de/designers/language-custom-functions/language-function-html-options.xml

111 lines
4.4 KiB
XML
Raw Normal View History

2004-04-13 08:46:28 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1.1 Maintainer: andreas Status: ready -->
2004-04-13 08:46:28 +00:00
<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&uuml;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&uuml;r die dropdown-Liste.</entry>
</row>
<row>
<entry>selected</entry>
<entry>string</entry>
<entry>Nein</entry>
<entry><emphasis>empty</emphasis></entry>
<entry>Das ausgew&auml;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 &uuml;bergebenen Daten
zu erzeugen. Die Funktion k&uuml;mmert sich ebenfalls um das setzen des ausgew&auml;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&uuml;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&auml;hrend $customer_id auch leer sein kann *}
&lt;select name=customer_id&gt;
{html_options values=$cust_ids selected=$customer_id output=$cust_names}
&lt;/select&gt;
{* alternativ k&ouml;nnen die Werte aus 'values' und 'output' als assoziative Arrays
an 'options' &uuml;bergeben werden. $customer_options ist in diesem Beispiel ein assoziatives Array *}
&lt;select name=customer_id&gt;
{html_options options=$customer_options selected=$customer_id}
&lt;/select&gt;
AUSGABE:
&lt;select name=customer_id&gt;
&lt;option value="1000">Joe Schmoe&lt;/option&gt;
&lt;option value="1001" selected="selected">Jack Smith&lt;/option&gt;
&lt;option value="1002">Jane Johnson&lt;/option&gt;
&lt;option value="1003">Charlie Brown&lt;/option&gt;
&lt;/select&gt;</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
-->