2004-04-13 08:46:28 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
<!-- $Revision$ -->
|
2004-10-02 12:49:29 +00:00
|
|
|
|
<!-- EN-Revision: 1.2 Maintainer: thomasgm Status: ready -->
|
2004-04-13 08:46:28 +00:00
|
|
|
|
<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>Nome do Atributo</entry>
|
|
|
|
|
|
<entry>Tipo</entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>Obrigat<EFBFBD>rio</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
<entry>Padr<EFBFBD>o</entry>
|
|
|
|
|
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>values</entry>
|
|
|
|
|
|
<entry>array</entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>Sim, a menos que usando atributos de options</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>uma matriz de valores para o menu dropdown</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>output</entry>
|
|
|
|
|
|
<entry>array</entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>Sim, a menos que usando atributos de options</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>uma matriz de sa<73>da para o menu dropdown</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>selected</entry>
|
|
|
|
|
|
<entry>string/array</entry>
|
|
|
|
|
|
<entry>N<EFBFBD>o</entry>
|
|
|
|
|
|
<entry><emphasis>empty</emphasis></entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>o elemento do options selecionado</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>options</entry>
|
|
|
|
|
|
<entry>associative array</entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>Sim, a menos que usando values e output</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<entry>uma matriz associativa de output e output</entry>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>name</entry>
|
|
|
|
|
|
<entry>string</entry>
|
|
|
|
|
|
<entry>N<EFBFBD>o</entry>
|
|
|
|
|
|
<entry><emphasis>empty</emphasis></entry>
|
|
|
|
|
|
<entry>nome do grupo selecionado</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</tgroup>
|
|
|
|
|
|
</informaltable>
|
|
|
|
|
|
<para>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
html_options <20> uma fun<75><6E>o personalizada que cria um grupo html option com os dados fornecidos.
|
|
|
|
|
|
Ela est<73> atenta de quais itens est<73>o selecionados por padr<64>o. Atributos obrigat<61>rios s<>o 'values' e
|
|
|
|
|
|
'output', a menos que voc<6F> use options no lugar.
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Se um valor dado <20> um array, ele ser<65> tratado como um OPTGROUP html,
|
|
|
|
|
|
e mostrar<61> os grupos.
|
2004-10-01 14:39:42 +00:00
|
|
|
|
Recursividade <20> suportada pelo OPTGROUP. Todas as sa<73>das s<>o compat<61>veis com XHTML.
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Se o atributo opcional <emphasis>name</emphasis> <20> dado, as tags
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<select name="groupname"></select> ir<69>o incluir a lista de op<6F><70>es dentro dela.
|
2004-04-13 08:46:28 +00:00
|
|
|
|
Caso contr<74>rio apenas a lista de op<6F><70>es <20> gerada.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Todos os par<61>metros que n<>o est<73>o na lista acima s<>o exibidos como
|
2004-10-01 14:39:42 +00:00
|
|
|
|
nome/valor dentro de <select>-tag. Eles s<>o ignorados se o opcional
|
|
|
|
|
|
<emphasis>name</emphasis> n<>o <20> fornecido.
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>html_options</title>
|
|
|
|
|
|
<programlisting>
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<![CDATA[
|
2004-04-13 08:46:28 +00:00
|
|
|
|
index.php:
|
|
|
|
|
|
|
|
|
|
|
|
require('Smarty.class.php');
|
|
|
|
|
|
$smarty = new Smarty;
|
2004-10-01 14:39:42 +00:00
|
|
|
|
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
|
|
|
|
|
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
|
2004-04-13 08:46:28 +00:00
|
|
|
|
Johnson','Carlie Brown'));
|
2004-10-01 14:39:42 +00:00
|
|
|
|
$smarty->assign('customer_id', 1001);
|
|
|
|
|
|
$smarty->display('index.tpl');
|
2004-04-13 08:46:28 +00:00
|
|
|
|
|
|
|
|
|
|
index.tpl:
|
|
|
|
|
|
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<select name=customer_id>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
{html_options values=$cust_ids selected=$customer_id output=$cust_names}
|
2004-10-01 14:39:42 +00:00
|
|
|
|
</select>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.php:
|
|
|
|
|
|
|
|
|
|
|
|
require('Smarty.class.php');
|
|
|
|
|
|
$smarty = new Smarty;
|
2004-10-01 14:39:42 +00:00
|
|
|
|
$smarty->assign('cust_options', array(
|
|
|
|
|
|
1001 => 'Taniel Franklin',
|
|
|
|
|
|
1002 => 'Fernando Correa',
|
|
|
|
|
|
1003 => 'Marcelo Pereira',
|
|
|
|
|
|
1004 => 'Charlie Brown'));
|
|
|
|
|
|
$smarty->assign('customer_id', 1001);
|
|
|
|
|
|
$smarty->display('index.tpl');
|
2004-04-13 08:46:28 +00:00
|
|
|
|
|
|
|
|
|
|
index.tpl:
|
|
|
|
|
|
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<select name=customer_id>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
{html_options options=$cust_options selected=$customer_id}
|
2004-10-01 14:39:42 +00:00
|
|
|
|
</select>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OUTPUT: (both examples)
|
|
|
|
|
|
|
2004-10-01 14:39:42 +00:00
|
|
|
|
<select name=customer_id>
|
|
|
|
|
|
<option value="1000">Taniel Franklin</option>
|
|
|
|
|
|
<option value="1001" selected="selected">Fernando Correa</option>
|
|
|
|
|
|
<option value="1002">Marcelo Pereira</option>
|
|
|
|
|
|
<option value="1003">Charlie Brown</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
2004-04-13 08:46:28 +00:00
|
|
|
|
</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
|
|
|
|
|
|
-->
|