pollita Fri Feb 20 13:05:33 2004 EDT
Modified files:
/phpdoc/entities global.ent
/phpdoc/en/chapters tutorial.xml
Log:
New Documentation: Dealing with XForms
http://cvs.php.net/diff.php/phpdoc/entities/global.ent?r1=1.165&r2=1.166&ty=u
Index: phpdoc/entities/global.ent
diff -u phpdoc/entities/global.ent:1.165 phpdoc/entities/global.ent:1.166
--- phpdoc/entities/global.ent:1.165 Fri Feb 13 11:18:00 2004
+++ phpdoc/entities/global.ent Fri Feb 20 13:05:31 2004
@@ -1,6 +1,6 @@
<!-- -*- SGML -*-
- $Id: global.ent,v 1.165 2004/02/13 16:18:00 vrana Exp $
+ $Id: global.ent,v 1.166 2004/02/20 18:05:31 pollita Exp $
Contains global "macros" for all the XML documents.
@@ -287,6 +287,8 @@
<!ENTITY url.xdebug "http://www.xdebug.org/">
<!ENTITY url.xdiff "http://www.xmailserver.org/xdiff-lib.html">
<!ENTITY url.xitami "http://www.xitami.com/">
+<!ENTITY url.xforms "http://www.w3.org/MarkUp/Forms/">
+<!ENTITY url.xforms.htmlauthors
"http://www.w3.org/MarkUp/Forms/2003/xforms-for-html-authors.html">
<!ENTITY url.xml "http://www.w3.org/XML/">
<!ENTITY url.xmlrpc "http://www.xmlrpc.com/">
<!ENTITY url.xmlrpc-epi "http://xmlrpc-epi.sourceforge.net/">
http://cvs.php.net/diff.php/phpdoc/en/chapters/tutorial.xml?r1=1.29&r2=1.30&ty=u
Index: phpdoc/en/chapters/tutorial.xml
diff -u phpdoc/en/chapters/tutorial.xml:1.29 phpdoc/en/chapters/tutorial.xml:1.30
--- phpdoc/en/chapters/tutorial.xml:1.29 Wed Jan 28 19:35:22 2004
+++ phpdoc/en/chapters/tutorial.xml Fri Feb 20 13:05:32 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.29 $ -->
+<!-- $Revision: 1.30 $ -->
<chapter id="tutorial">
<title>A simple tutorial</title>
@@ -424,6 +424,96 @@
<function>import_request_variables</function> function.
</para>
</sect1>
+
+ <sect1 id="tutorial.xforms">
+ <title>Dealing with XForms</title>
+ <para>
+ <ulink url="&url.xforms;">XForms</ulink> defines a variation on traditional
+ webforms which allows them to be used on a wider variety of platforms and
+ browsers or even non-traditional media such as PDF documents.
+ </para>
+ <para>
+ The first key difference in xforms is how the form is sent to the client.
+ <ulink url="&url.xforms.htmlauthors;">XForms for HTML Authors</ulink>
+ contains a detailed description of how to create XForms, for the purpose
+ of this tutorial we'll only be looking at a simple example.
+ </para>
+ <example>
+ <title>A simple XForms search form</title>
+ <screen>
+<![CDATA[
+<h:html xmlns:h="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/2002/xforms">
+<h:head>
+ <h:title>Search</h:title>
+ <model>
+ <submission action="http://example.com/search"
+ method="post" id="s"/>
+ </model>
+</h:head>
+<h:body>
+ <h:p>
+ <input ref="q"><label>Find</label></input>
+ <submit submission="s"><label>Go</label></submit>
+ </h:p>
+</h:body>
+</h:html>
+]]>
+ </screen>
+ </example>
+ <para>
+ The above form displays a text input box (named <parameter>q</parameter>),
+ and a submit button. When the submit button is clicked, the form will be
+ sent to the page referred to by action.
+ </para>
+ <para>
+ Here's where it starts to look different from your web application's point
+ of view. In a normal HTML form, the data would be sent as
+ application/x-www-form-urlencoded, in the XForms world however, this information
+ is sent as XML formatted data.
+ </para>
+ <para>
+ If you're choosing to work with XForms then you probably want that data as
+ XML, in that case, look in $HTTP_RAW_POST_DATA where you'll find the XML
+ document generated by the browser which you can pass into your favorite
+ XSLT engine or document parser.
+ </para>
+ <para>
+ If you're not interrested in formatting and just want your data to be loaded
+ into the traditional $_POST variable, you can instruct the client browser
+ to send it as application/x-www-form-urlencoded by changing the
+ <parameter>method</parameter> attribute to <emphasis>urlencoded-post</emphasis>.
+ </para>
+ <example>
+ <title>Using an XForm to populate $_POST</title>
+ <screen>
+<![CDATA[
+<h:html xmlns:h="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/2002/xforms">
+<h:head>
+ <h:title>Search</h:title>
+ <model>
+ <submission action="http://example.com/search"
+ method="urlencoded-post" id="s"/>
+ </model>
+</h:head>
+<h:body>
+ <h:p>
+ <input ref="q"><label>Find</label></input>
+ <submit submission="s"><label>Go</label></submit>
+ </h:p>
+</h:body>
+</h:html>
+]]>
+ </screen>
+ </example>
+ <note>
+ <simpara>
+ As of this writing, many browsers do not support XForms.
+ Check your browser version if the above examples fail.
+ </simpara>
+ </note>
+ </sect1>
<sect1 id="tutorial.oldcode">
<title>Using old code with new versions of PHP</title>