gal Tue Jan 29 16:41:10 2002 EDT
Added files:
/phpdoc/he/faq html.xml
Log:
initial translation
Index: phpdoc/he/faq/html.xml
+++ phpdoc/he/faq/html.xml
<?xml version="1.0" encoding="iso-8859-i"?>
<!-- $Revision: 1.1 $ -->
<chapter id="faq.html">
<title>PHP �-HTML</title>
<titleabbrev>PHP �-HTML</titleabbrev>
<para>
PHP �-HTML ������ ����� ����� ��� �� �����: PHP ����� HTML,
��-HTML �� ���� ����� �-PHP ����� ����.
</para>
<qandaset>
<qandaentry id="faq.html.encoding">
<question>
<para>
���� �����/����� ��� ���� ���� ���� ����� ��� ������� ����?
�������� ����� (URL)?
</para>
</question>
<answer>
<para>
���� ��� ����� ��� ������ ����. ����� ������ <type>������</type>
<varname>$data</varname>, ������ �� ������� ������� ������ ����
����� �� ������ (��� ���� HTML), ��� ������ �������:
<itemizedlist>
<listitem>
<para>
����� HTML. ���� ����� ������ �����, <emphasis>����</emphasis>
���� ����� ���� ��� ������ ������, ������� �� ���� ��������
htmlspecialchars.
</para>
</listitem>
<listitem>
<para>
����� ������� (URL): ����� ������� ������ ���� �����. �� ������ ������
������ ����� (item) ���, <emphasis>����</emphasis> ���� ����� ���� �����
�������� <function>urlencode</function>.
</para>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title>���� ����� (hidden) ����� HTML</title>
<programlisting role="php">
<![CDATA[
<?php
echo "<input type=hidden value=\"" . htmlspecialchars($data) . "\">\n";
?>
]]>
</programlisting>
</example>
<note>
<simpara>
���� ���� ����� <function>urlencode</function>
�-<varname>$data</varname>, ���� ���� ������ ������ �����
<function>urlencode</function> �����. �� �������� ��������� ����� ���
����. ��� �� ���� ��� ��� ����� ������ (�����, GET �� POST). �����
���, �� ����� ����� �� GET ���� ������ ���, ���� ����� ����� �� POST
���� ��� �����.
</simpara>
</note>
<example>
<title>���� ����� ������ �� ������</title>
<programlisting role="php">
<![CDATA[
<?php
echo "<textarea name=mydata>\n";
echo htmlspecialchars($data)."\n";
echo "</textarea>";
?>
]]>
</programlisting>
</example>
<note>
<simpara>
����� ����� ������ ���� �������, ��� ���� ������� ���� �� ����� ��������
�� HTML ������� �������.
</simpara>
<simpara>
���� �����, �� ��� GET �� ��� POST, ����� ���� ����� urlencoded ��������
��� ������ ���� �����, ��� �������� ����� urldecoded ��-��� PHP. ��
������
�� ���, ��� �� ���� ���� �� urldecoded �� urldecoding �����, ��� �����
����� ��������.
</simpara>
</note>
<example>
<title>����� ����� URL</title>
<programlisting role="php">
<![CDATA[
<?php
echo "<a href=\"" . htmlspecialchars("/nexpage.php?stage=23&data=" .
urlencode($data)) . "\">\n";
?>
]]>
</programlisting>
</example>
<note>
<simpara>
����, ���� ����� �� ����� ����� HTML ������ GET,
��� ������ ���� ����� <function>urlencode</function>
����� ������ ����� �����.
</simpara>
</note>
<note>
<simpara>
���� ���� <function>htmlspecialchars</function> ��� �-URL, ���� ��-URL
����� ���� ����� �� HTML (�����, HTML-attribute). ����� ���, ������ ������
����� �� ���� ���-<function>htmlspecialchars</function>, ��� �� ����� ��
�-URL ����. PHP ����� �� �-URL ����� ������ ���, ���� �����-�� ���� ����
<function>urlencoded</function>.
</simpara>
<simpara>
���� ���� �� ����� <literal>&</literal> ���� ������ ����� �����
<literal>&amp;</literal>. ����� ���� �������� ������ ������ ��
��� �� �� ����, �� �� ���� �����. ���, ����� �� ������ ���� ������,
<emphasis>����</emphasis> ���� �����
<function>htmlspecialchars</function>
������.
</simpara>
</note>
</para>
<!-- TODO: a note about addgpcslashes? -->
</answer>
</qandaentry>
<qandaentry id="faq.html.form-image">
<question>
<para>
��� ���� ������ ��� <input type="image">, ���
�� ���� ���� ������ $foo.x �-$foo.y. ���� ��?
</para>
</question>
<answer>
<para>
���� ����� ����, ���� ��� �� ����� ������ (image) ����� ������
������ (submit) �������� �� ����� ��� ���:
<programlisting role="html">
<![CDATA[
<input type="image" src="image.gif" name="foo">
]]>
</programlisting>
���� ������ ���� ����� ����� �� ������, ����� ������ ���� ����
�� ��� ������ ������: foo.x �-foo.y.
</para>
<para>
���� �-$foo.x �-$foo.y ���� ������ �������� ��-��� PHP, ������� ������
�������� �-$foo_x �-$foo_y. �� ����� ���� ��� �������� ������� �������
����� �������.
</para>
</answer>
</qandaentry>
<qandaentry id="faq.html.arrays">
<question>
<para>��� ���� ����� ������ ����� HTML?</para>
</question>
<answer>
<para>
��� ������ <link linkend="language.types.array">����</link> ������
�� ���� - <form> - ����� ������� (���) �-PHP ���, ���� �����
���� <input>, <select> �- <textarea> ����� ���:
<programlisting role="html">
<![CDATA[
<input name="MyArray[]">
<input name="MyArray[]">
<input name="MyArray[]">
<input name="MyArray[]">
]]>
</programlisting>
���� ����� ������ �� �������� �������� ���� �� ������, �� �� �����
������ ����� �����. ���� ����� �� ���� ��� ������� ����� ���� �����
����� ����� ��-��� ����� ���� �� ���� �������� ����� �����:
<programlisting role="html">
<![CDATA[
<input name="MyArray[]">
<input name="MyArray[]">
<input name="MyOtherArray[]">
<input name="MyOtherArray[]">
]]>
</programlisting>
��� �� ���� ��� ������, MyArray �-MyOtherArray, ��� ������ �������
�-PHP. ���-��, ���� �� ������ ������ �������� ������ �����:
<programlisting role="html">
<![CDATA[
<input name="AnotherArray[]">
<input name="AnotherArray[]">
<input name="AnotherArray[email]">
<input name="AnotherArray[phone]">
]]>
</programlisting>
���� AnotherArray ���� ������ �� ������� 0, 1, email �-phone.
</para>
<para>
<note>
<para>
����� ������ ����� ������� ��� �� ������� ������ �-HTML, ���� ����
����. �� �� ������� �������, ����� ���� �� ������ ������� ���� ���
�� ������ �����. ������ ������� ������ ������ �� ������� 0, 1, 2 �-3.
</para>
</note>
</para>
<para>
See also
<link linkend="ref.array">�������� �������</link> �
<link linkend="language.variables.external">������ ���� PHP ������</link>.
</para>
</answer>
</qandaentry>
<qandaentry id="faq.html.select-multiple">
<question>
<para>
��� ���� ���� �� �� ������� ����� ����� (select) ��� ������ ����� HTML?
</para>
</question>
<answer>
<para>
���� ������ ��� ������� �-HTML ������ �������� ����� ���� ������
���� �����. ����-��� ������� ������� ������ �� �����. ����� ���
��� ������� ������� �� ���� �� �����. ������:
<programlisting role="html">
<![CDATA[
<select name="var" multiple>
]]>
</programlisting>
�� ������ ����� ���� ����� �� �����, ���:
<programlisting>
var=option1
var=option2
var=option3
</programlisting>
�� ������ ���� �� ������� ������ ������
<varname>$var</varname> �����. ������� ��� ������ �������
"���� ������ ���� ����" ����� �-PHP. ���� ��� ���� ���
����� ���:
<programlisting role="html">
<![CDATA[
<select name="var[]" multiple>
]]>
</programlisting>
��� �� ���� �-PHP ������� �-<varname>$var</varname> �����
��� �� ���� �� ��� �-var[] ������ ���� �����. ����� ������
���� �-<varname>$var[0]</varname>, ��� �����
�-<varname>$var[1]</varname>, ��� ����. ��������
<function>count</function> ����� ������ ��� ����� ��� ��������
����� �����, ��������� <function>sort</function> ����� ������
��� ���� �� ���������, �� ���� ��� ����.
</para>
<para>
���� ���� �� ��� ���� ���� ����� �-JavaScript, �����
<literal>[]</literal> ��� ������ ���� ����� ������ ��� ������
����� ������ ��� ���. ����� ����� ����� �� ��� ���� ������ ���
����� form �� JavaScript �����, �� ����� �� �� ������ ��� ������
(������ / �� ������) ������� �� ������� �� ����� ����� ��
JavaScript, ������:
<programlisting>
variable = documents.forms[0].elements['var[]'];
</programlisting>
</para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<!-- 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
-->