mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-01 21:01:37 +01:00
sync with EN
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.8 Maintainer: gerald Status: ready -->
|
||||
<!-- EN-Revision: 1.11 Maintainer: yannick Status: ready -->
|
||||
|
||||
<sect1 id="language.function.html.checkboxes">
|
||||
<title>html_checkboxes</title>
|
||||
<title>{html_checkboxes}</title>
|
||||
<para>
|
||||
{html_checkboxes} est une
|
||||
<link linkend="language.custom.functions">fonction utilisateur</link>
|
||||
qui cr<63>e un groupe de cases <20> cocher avec les donn<6E>es fournies. Elle prend
|
||||
en compte la liste des <20>l<EFBFBD>ments s<>lectionn<6E>s par d<>faut. Les attributs requis
|
||||
sont values et output, <20> moins que vous n'utilisiez options <20> la place.
|
||||
La sortie g<>n<EFBFBD>r<EFBFBD>e est compatible XHTML.
|
||||
</para>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
@@ -78,41 +87,35 @@
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_checkboxes est une fonction utilisateur qui cr<63>e un groupe de
|
||||
cases <20> cocher avec les donn<6E>es fournies. Elle prend en compte la liste
|
||||
des <20>l<EFBFBD>ments s<>lectionn<6E>s par d<>faut. Les attributs requis sont
|
||||
values et output, <20> moins que vous n'utilisiez options <20> la place.
|
||||
La sortie g<>n<EFBFBD>r<EFBFBD>e est compatible XHTML.
|
||||
</para>
|
||||
<para>
|
||||
Tous les param<61>tres qui ne sont pas list<73>s ci-dessus sont affich<63>s
|
||||
en tant que paires nom/valeur dans chaque balise <input> cr<63>e.
|
||||
</para>
|
||||
<example>
|
||||
<title>html_checkboxes</title>
|
||||
<para>
|
||||
O<> le code PHP est :
|
||||
</para>
|
||||
<title>{html_checkboxes}</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||||
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane Johnson','Charlie Brown'));
|
||||
$smarty->assign('cust_names', array(
|
||||
'Joe Schmoe',
|
||||
'Jack Smith',
|
||||
'Jane Johnson',
|
||||
'Charlie Brown')
|
||||
);
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
et index.tpl est:
|
||||
o<EFBFBD> index.tpl est :
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"}
|
||||
{html_checkboxes name="id" values=$cust_ids output=$cust_names
|
||||
selected=$customer_id separator="<br />"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -122,20 +125,19 @@ $smarty->display('index.tpl');
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('cust_checkboxes', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown'));
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown')
|
||||
);
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
et index.tpl est:
|
||||
et index.tpl est :
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -148,13 +150,43 @@ $smarty->display('index.tpl');
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
|
||||
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br />
|
||||
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label>
|
||||
<br />
|
||||
<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />
|
||||
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<example>
|
||||
<title>
|
||||
Exemple avec une base de donn<6E>es (eg PEAR ou ADODB) :
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$sql = 'select type_id, types from types order by type';
|
||||
$smarty->assign('types',$db->getAssoc($sql));
|
||||
|
||||
$sql = 'select * from contacts where contact_id=12';
|
||||
$smarty->assign('contact',$db->getRow($sql));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name="type" options=$types selected=$contact.type_id separator="<br />"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Voir aussi
|
||||
<link linkend="language.function.html.radios">{html_radios}</link> et
|
||||
<link linkend="language.function.html.options">{html_options}</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
@@ -174,4 +206,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
||||
Reference in New Issue
Block a user