mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-10 01:01:45 +01:00
added Japanese translation files.
This commit is contained in:
@@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.17 Maintainer: takagi Status: ready -->
|
||||
<!-- CREDITS: mat-sh,daichi,joe -->
|
||||
<sect1 id="language.function.html.checkboxes">
|
||||
<title>{html_checkboxes}</title>
|
||||
<para>
|
||||
<varname>{html_checkboxes}</varname> は、
|
||||
提供されたデータから HTML チェックボックスグループを作成する
|
||||
<link linkend="language.custom.functions">カスタム関数</link>
|
||||
です。デフォルトで選択されているアイテムの指定もうまく配慮されます。
|
||||
</para>
|
||||
|
||||
<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>属性名</entry>
|
||||
<entry>型</entry>
|
||||
<entry>必須</entry>
|
||||
<entry>デフォルト</entry>
|
||||
<entry>概要</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>checkbox</emphasis></entry>
|
||||
<entry>チェックボックスリストの名前</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>values</entry>
|
||||
<entry>array</entry>
|
||||
<entry>Yes (options属性を用いない場合)</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>チェックボックスボタンの値の配列</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>output</entry>
|
||||
<entry>array</entry>
|
||||
<entry>Yes (options属性を用いない場合)</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>チェックボックスボタンの出力の配列</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>selected</entry>
|
||||
<entry>string/array</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>empty</emphasis></entry>
|
||||
<entry>あらかじめ選択されたチェックボックス要素群</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>options</entry>
|
||||
<entry>associative array</entry>
|
||||
<entry>Yes (valuesとoutput属性を用いない場合)</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>values属性とoutput属性の連想配列</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>separator</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>empty</emphasis></entry>
|
||||
<entry>各チェックボックスアイテムを区分するための文字列</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>empty</emphasis></entry>
|
||||
<entry>チェックボックスのタグを出力せずに配列に格納する</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>labels</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>&true;</emphasis></entry>
|
||||
<entry>出力に <label> タグを加える</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>empty</emphasis></entry>
|
||||
<entry>各チェックボックスの出力をひとつの要素とする配列に格納する</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<parameter>options</parameter> を使用しない場合は、
|
||||
必須の属性は <parameter>values</parameter> および
|
||||
<parameter>output</parameter> となります。
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
全ての出力は XHTML 準拠です。
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
上の属性リストに無いパラメータが与えられた場合は、作成された各
|
||||
<input> タグの内側に名前/値のペアで表されます。
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<example>
|
||||
<title>{html_checkboxes}</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||||
$smarty->assign('cust_names', array(
|
||||
'Joe Schmoe',
|
||||
'Jack Smith',
|
||||
'Jane Johnson',
|
||||
'Charlie Brown')
|
||||
);
|
||||
$smarty->assign('customer_id', 1001);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
テンプレート
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name='id' values=$cust_ids output=$cust_names
|
||||
selected=$customer_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
あるいは、このような PHP コードに対して
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty->assign('cust_checkboxes', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown')
|
||||
);
|
||||
$smarty->assign('customer_id', 1001);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
テンプレートはこのようになります。
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name='id' options=$cust_checkboxes
|
||||
selected=$customer_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
どちらも、出力は次のようになります。
|
||||
</para>
|
||||
<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="1002" />Jane Johnson</label><br />
|
||||
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<example>
|
||||
<title>
|
||||
データベースの例 (PEAR あるいは ADODB)
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$sql = 'select type_id, types from contact_types order by type';
|
||||
$smarty->assign('contact_types',$db->getAssoc($sql));
|
||||
|
||||
$sql = 'select contact_id, contact_type_id, contact '
|
||||
.'from contacts where contact_id=12';
|
||||
$smarty->assign('contact',$db->getRow($sql));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>データベースのクエリの出力</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name='contact_type_id' options=$contact_types
|
||||
selected=$contact.contact_type_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
<link linkend="language.function.html.radios"><varname>{html_radios}</varname></link>
|
||||
および
|
||||
<link linkend="language.function.html.options"><varname>{html_options}</varname></link>
|
||||
も参照してください。
|
||||
</para>
|
||||
</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
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user