cvs: peardoc /en/package/html/html-template-flexy/attribute flexyignore.xml flexystart.xml flexystartchildren.xml form.xml input.xml select.xml
textarea.xml

From: Date: Thu, 29 Jan 2004 16:32:26 +0000
Subject: cvs: peardoc /en/package/html/html-template-flexy/attribute flexyignore.xml flexystart.xml flexystartchildren.xml form.xml input.xml select.xml
textarea.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-2257@lists.php.net to get a copy of this message
alan_k Thu Jan 29 11:32:26 2004 EDT Modified files: /peardoc/en/package/html/html-template-flexy/attribute flexyignore.xml flexystart.xml flexystartchildren.xml form.xml input.xml select.xml textarea.xml Log: update the horribly outdated documentation

http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/attribute/flexyignore.xml?r1=1.3&r2=1.4&ty=u Index: peardoc/en/package/html/html-template-flexy/attribute/flexyignore.xml diff -u peardoc/en/package/html/html-template-flexy/attribute/flexyignore.xml:1.3 peardoc/en/package/html/html-template-flexy/attribute/flexyignore.xml:1.4 --- peardoc/en/package/html/html-template-flexy/attribute/flexyignore.xml:1.3 Mon Apr 7 11:50:29 2003 +++ peardoc/en/package/html/html-template-flexy/attribute/flexyignore.xml Thu Jan 29 11:32:26 2004 @@ -1,7 +1,7 @@ -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-template-flexy.attribute.flexyignore"> <refnamediv> - <refname>flexy:ignore</refname> + <refname>flexy:ignore=&quot;yes&quot;</refname> <refpurpose>Prevent Automatic form value replacement</refpurpose> </refnamediv> <refsynopsisdiv> @@ -10,7 +10,7 @@ <funcprototype> <funcdef> <function>Usage</function></funcdef> - <paramdef><parameter>flexy:ignore</parameter></paramdef> + <paramdef><parameter>flexy:ignore=&quot;yes&quot;</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -35,21 +35,27 @@ <programlisting role="html"> <![CDATA[ -<form name="theform"> - <input name="theinput"> +<form name="theform1"> + <input name="theinput1"> <input name="theinput2" value="dummy"> </form> <form name="theform2" flexy:ignore> - <input name="theinput" value="dummy"> - <input name="theinput2" value="dummy"> + <input name="theinput3" value="dummy"> + <input name="theinput4" value="dummy"> </form> -<form name="theform2"> - <input name="theinput" value="dummy" flexy:ignore> - <input name="theinput2" value="dummy"> +<form name="theform3"> + <input name="theinput5" value="dummy" flexy:ignore> + <input name="theinput6" value="dummy"> </form> +<form name="theform4" flexy:ignoreonly="yes"> + <input name="theinput7" value="dummy"> + <input name="theinput8" value="dummy"> +</form> + + ]]> </programlisting> </example> @@ -59,22 +65,25 @@ <programlisting role="html"> <![CDATA[ -<?php $this->setActiveQuickForm(0);echo $this->quickform->formHeadToHtml(); ?> - <?php echo $this->quickform->elementToHtml("theinput"); ?> - <?php echo $this->quickform->elementToHtml("theinput2"); ?> + <?php echo $this->elements['theform1']->toHtmlnoClose();?> + <?php echo $this->elements['theinput1']->toHtml();?> + <?php echo $this->elements['theinput2']->toHtml();?> + </form> + +<form name="theform2"> + <input name="theinput3" value="dummy"> + <input name="theinput4" value="dummy"> </form> - -<FORM NAME="theform2"> - <INPUT NAME="theinput" VALUE="dummy"> - <INPUT NAME="theinput2" VALUE="dummy"> -</FORM> - -<?php $this->setActiveQuickForm(1);echo $this->quickform->formHeadToHtml(); ?> - <INPUT NAME="theinput" VALUE="dummy"> - <?php echo $this->quickform->elementToHtml("theinput2"); ?> + +<?php echo $this->elements['theform3']->toHtmlnoClose();?> + <input name="theinput5" value="dummy" flexy:ignore> + <?php echo $this->elements['theinput6']->toHtml();?> </form> - - + + <form name="theform4"> + <?php echo $this->elements['theinput7']->toHtml();?> + <?php echo $this->elements['theinput8']->toHtml();?> + </form> ]]> </programlisting> http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/attribute/flexystart.xml?r1=1.2&r2=1.3&ty=u Index: peardoc/en/package/html/html-template-flexy/attribute/flexystart.xml diff -u peardoc/en/package/html/html-template-flexy/attribute/flexystart.xml:1.2 peardoc/en/package/html/html-template-flexy/attribute/flexystart.xml:1.3 --- peardoc/en/package/html/html-template-flexy/attribute/flexystart.xml:1.2 Mon Mar 10 17:27:43 2003 +++ peardoc/en/package/html/html-template-flexy/attribute/flexystart.xml Thu Jan 29 11:32:26 2004 @@ -1,7 +1,7 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.attribute.flexystart"> <refnamediv> - <refname>FLEXYSTART</refname> + <refname>flexy:start=&quot;here&quot;</refname> <refpurpose>Start the output, using this tag and it's children.</refpurpose> </refnamediv> <refsynopsisdiv> @@ -10,7 +10,7 @@ <funcprototype> <funcdef> <function>Usage</function></funcdef> - <paramdef><parameter>FLEXYSTART</parameter></paramdef> + <paramdef><parameter>flexy:start=&quot;here&quot;</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -20,9 +20,11 @@ Tells the generator to start outputing using this tag. This can be useful if you want to edit the template in a editor that expects a head/footer, and you can list the available tags in the comments at the top of the page. + </para> - - + <para> + The actual value of the tag is not relivant. + </para> </refsect1> @@ -32,15 +34,15 @@ <example> - <title>Template with FLEXYSTART</title> + <title>Template with flexy:start</title> <programlisting role="html"> <![CDATA[ <HTML> <HEAD></HEAD> <BODY> <H1>This is an example</H1> - <FORM name="input" FLEXYSTART FLEXYOBJECT="test"> - <INPUT name="hello"> + <FORM name="input" flexy:start="yes"> + <INPUT name="hello" flexy:ignore="yes"> </FORM> </BODY> </HTML> @@ -56,8 +58,7 @@ <![CDATA[ <FORM NAME="input"> - <INPUT NAME="hello" VALUE="<?php echo htmlspecialchars($t->test->hello); ?>"><?php - if (isset($this->errors['test.hello'])) { echo htmlspecialchars($this->errors['test.hello']); } ?> + <INPUT NAME="hello"> </FORM> ]]> </programlisting> http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/attribute/flexystartchildren.xml?r1=1.2&r2=1.3&ty=u Index: peardoc/en/package/html/html-template-flexy/attribute/flexystartchildren.xml diff -u peardoc/en/package/html/html-template-flexy/attribute/flexystartchildren.xml:1.2 peardoc/en/package/html/html-template-flexy/attribute/flexystartchildren.xml:1.3 --- peardoc/en/package/html/html-template-flexy/attribute/flexystartchildren.xml:1.2 Mon Mar 10 17:27:43 2003 +++ peardoc/en/package/html/html-template-flexy/attribute/flexystartchildren.xml Thu Jan 29 11:32:26 2004 @@ -1,7 +1,7 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.attribute.flexystartchildren"> <refnamediv> - <refname>FLEXYSTARTCHILDREN</refname> + <refname>flexy:startchildren=&quot;here&quot;</refname> <refpurpose>Start the output using it's children.</refpurpose> </refnamediv> <refsynopsisdiv> @@ -10,7 +10,7 @@ <funcprototype> <funcdef> <function>Usage</function></funcdef> - <paramdef><parameter>FLEXYSTARTCHILDREN</parameter></paramdef> + <paramdef><parameter>flexy:startchildren=&quot;here&quot;</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -21,7 +21,9 @@ want to edit the template in a editor that expects a head/footer, normally adding this to body </para> - + <para> + The actual value of the tag is not relivant. + </para> </refsect1> @@ -37,10 +39,10 @@ <![CDATA[ <HTML> <HEAD></HEAD> - <BODY FLEXYSTARTCHILDREN> + <BODY flexy:startchildren="here"> <H1>This is an example</H1> - <FORM name="input" FLEXYOBJECT="test"> - <INPUT name="hello"> + <FORM name="input" flexy:ignoreonly="yes"> + <INPUT name="hello" flexy:ignore="yes"> </FORM> </BODY> </HTML> @@ -57,8 +59,7 @@ <H1>This is an example</H1> <FORM NAME="input"> - <INPUT NAME="hello" VALUE="<?php echo htmlspecialchars($t->test->hello); ?>"><?php - if (isset($this->errors['test.hello'])) { echo htmlspecialchars($this->errors['test.hello']); } ?> + <INPUT NAME="hello"> </FORM> ]]> http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/attribute/form.xml?r1=1.3&r2=1.4&ty=u Index: peardoc/en/package/html/html-template-flexy/attribute/form.xml diff -u peardoc/en/package/html/html-template-flexy/attribute/form.xml:1.3 peardoc/en/package/html/html-template-flexy/attribute/form.xml:1.4 --- peardoc/en/package/html/html-template-flexy/attribute/form.xml:1.3 Mon May 12 16:49:32 2003 +++ peardoc/en/package/html/html-template-flexy/attribute/form.xml Thu Jan 29 11:32:26 2004 @@ -1,7 +1,7 @@ -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-template-flexy.tag.form"> <refnamediv> - <refname>&lt;FORM NAME="name" FLEXYOBJECT="name"&gt;</refname> + <refname>&lt;FORM NAME="name"</refname> <refpurpose>configures automatic form elements</refpurpose> </refnamediv> <refsynopsisdiv> @@ -10,145 +10,140 @@ <funcprototype> <funcdef> <function>Usage</function></funcdef> - <paramdef><parameter>&lt;FORM NAME="name" FLEXYOBJECT="name"&gt;</parameter></paramdef> - <paramdef><parameter>&lt;FORM NAME="name" FLEXYIGNORE&gt;</parameter></paramdef> - <paramdef><parameter>&lt;FORM NAME="name"&gt;</parameter></paramdef> + <paramdef>&lt;<parameter>FORM NAME="name"</parameter>&gt;</paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.form.desc"> &title.desc; <para> - By default, all forms are filled in with PHP code to echo their value (using a mapping - of object to form element name). + By default, all forms are converted to HTML_Template_Flexy_Elements, so they can be altered at runtime. </para> </refsect1> - <refsect1 id="package.html.html-template-flexy.attribute.form.meanings"> - <title>Tag meanings</title> - <para> - <itemizedlist> - <listitem> - <para> - <parameter>NAME="formname"</parameter> - if no flexyobject tag is used, the form name is used as the object name. - A form element will use the variable eg. $t->formname->elementname - </para> - </listitem> - <listitem> - <para> - <parameter>FLEXYOBJECT="objectname"</parameter> - overrides the name tag so you can use different - form and object names. A form element will use the variable eg. $t->formname->elementname - If you set it to "" (blank), this resulting variable will be $t->elementname - </para> - </listitem> - <listitem> - <para> - <parameter>FLEXYIGNORE</parameter> - marks a form so no replacements occur. - </para> - </listitem> - </itemizedlist> - </para> - - </refsect1> + - <refsect1 id="package.html.html-template-flexy.tag.form.example"> + + <refsect1 id="package.html.html-template-flexy.tag.form.example"> &title.example; <example> - <title>Setting variables for input</title> - <programlisting role="html"> - <![CDATA[ - -$this->theform = new StdClass; -// or you can use a DataObject! -$this->theform->theinput = "hello world"; + <title>Using an element to change a template.</title> + <programlisting role="php"> + <![CDATA[ +$form = new HTML_Template_Flexy(); +$form->compile($this->masterTemplate); -]]> - </programlisting> - </example> - - <example> - <title>Using Form tags</title> - <programlisting role="html"> - <![CDATA[ - -<form name="theform"> -<input name="theinput"> -</form> - -<form name="theform2" flexyobject="theform"> -<input name="theinput"> -</form> - -<form name="theform2" flexyobject=""> -<input name="theinput"> -</form> - -<form name="theform2" flexyignore> -<input name="theinput" value="dummy"> -</form> +// create an instance (note you dont have to specify any details..) + +$elements['theform'] = new HTML_Template_Flexy_Element; + +// change an attribute +$elements['theform']->attributes['action'] = 'http://pear.php.net'; +// +// for the different types of elements: +$elements['test_textarea'] = new HTML_Template_Flexy_Element; +$elements['test_textarea']->setValue('Blogs'); + + +// select options +$elements['test_select'] = new HTML_Template_Flexy_Element; +$elements['test_select']->setOptions( array( + '123' => 'a select option' + '1234' => 'another select option' +)); +$elements['test_select']->setValue('1234'); + +// checkboxes +$elements['test_checkbox'] = new HTML_Template_Flexy_Element; +$elements['test_checkbox']->setValue(1); + +// array type checkboxes.. +$elements['test_checkbox[]'] = new HTML_Template_Flexy_Element; +$elements['test_checkbox[]']->setValue(array(1,2)); + +// radio buttons +$elements['test_radio'] = new HTML_Template_Flexy_Element; +$elements['test_radio']->setValue('yes'); + + +$form->output(new StdClass, $elements); + +// in the example below, the new data you have added is to the existing attributes + ]]> </programlisting> </example> - + <example> - <title>Compiled template</title> + <title>template example</title> <programlisting role="html"> <![CDATA[ - -<FORM NAME="theform"> -<INPUT NAME="theinput" VALUE="<?php echo htmlspecialchars($t->theform->theinput); ?>"><?php - if (isset($this->errors['theform.theinput'])) { echo - htmlspecialchars($this->errors['theform.theinput']); } ?> -</FORM> - -<FORM NAME="theform2"> -<INPUT NAME="theinput" VALUE="<?php echo htmlspecialchars($t->theform->theinput); ?>"><?php - if (isset($this->errors['theform.theinput'])) { echo - htmlspecialchars($this->errors['theform.theinput']); } ?> -</FORM> - -<FORM NAME="theform2"> -<INPUT NAME="theinput" VALUE="<?php echo htmlspecialchars($t->theinput); ?>"><?php - if (isset($this->errors['theinput'])) { echo htmlspecialchars($this->errors['theinput']); } ?> -</FORM> - -<FORM NAME="theform2"> -<INPUT NAME="theinput" value="dummy"> -</FORM> - - - +<BODY> + <FORM name="theform"> + + <TEXTAREA name="test_textarea"></TEXTAREA> + + <SELECT name="test_select"></SELECT> + + <input name="test_checkbox" type="checkbox" value="1"> + + <input name="test_checkbox_array[]" type="checkbox" value="1">1<BR> + <input name="test_checkbox_array[]" type="checkbox" value="2">2<BR> + <input name="test_checkbox_array[]" type="checkbox" value="3">3<BR> + + <input name="test_radio" type="radio" value="yes">yes<BR> + <input name="test_radio" type="radio" value="no">no<BR> + + </FORM> +</BODY> + + ]]> </programlisting> </example> - - <example> - <title>The resulting output</title> + + + <example> + <title>output from the Template</title> <programlisting role="html"> - <![CDATA[ + <![CDATA[ +<BODY> + <FORM name="theform" action="http://pear.php.net"> + + + <TEXTAREA name="test_textarea">Blogs</TEXTAREA> + + <SELECT name="test_select"> + <option value="123">a selection option</option> + <option value="1234" selected>another selection option</option> -** well since I cant show forms, It will look something like this.. - -[hello world] - -[hello world] - -[ ] + </SELECT> + + <input name="test_checkbox" type="checkbox" value="1" checked> + + <input name="test_checkbox_array[]" type="checkbox" value="1" checked>1<BR> + <input name="test_checkbox_array[]" type="checkbox" value="2" checked>2<BR> + <input name="test_checkbox_array[]" type="checkbox" value="3">3<BR> + + <input name="test_radio" type="radio" value="yes" checked>yes<BR> + <input name="test_radio" type="radio" value="no">no<BR> + + + </FORM> +</BODY> -[dummy ] - -]]> +]]> </programlisting> </example> - </refsect1> - + + </refsect1> http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/attribute/input.xml?r1=1.5&r2=1.6&ty=u Index: peardoc/en/package/html/html-template-flexy/attribute/input.xml diff -u peardoc/en/package/html/html-template-flexy/attribute/input.xml:1.5 peardoc/en/package/html/html-template-flexy/attribute/input.xml:1.6 --- peardoc/en/package/html/html-template-flexy/attribute/input.xml:1.5 Mon May 12 16:49:32 2003 +++ peardoc/en/package/html/html-template-flexy/attribute/input.xml Thu Jan 29 11:32:26 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="package.html.html-template-flexy.attribute.input"> <refnamediv> <refname>&lt;INPUT NAME="name"&gt;</refname> @@ -10,8 +10,8 @@ <funcprototype> <funcdef> <function>Usage</function></funcdef> - <paramdef><parameter>&lt;INPUT NAME="name"&gt;</parameter></paramdef> - <paramdef><parameter>&lt;INPUT NAME="name" flexyignore="TRUE"&gt;</parameter></paramdef> + <paramdef>&lt;<parameter>INPUT NAME="name"</parameter>&gt;</paramdef> + </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -27,64 +27,94 @@ - <refsect1 id="package.html.html-template-flexy.attribute.input.example"> + + <refsect1 id="package.html.html-template-flexy.attribute.input.example"> &title.example; <example> - <title>Setting variables for input</title> - <programlisting role="html"> + <title>Using an element to change a template.</title> + <programlisting role="php"> <![CDATA[ -$this->theform = new StdClass; -// or you can use a DataObject! -$this->theform->theinput = "hello world"; +$form = new HTML_Template_Flexy(); +$form->compile($this->masterTemplate); + +// create an instance (note you dont have to specify any details..) + +$elements['test'] = new HTML_Template_Flexy_Element; + +// change an attribute +$elements['test']->attributes['class'] = 'bold'; + +// sets the value +$elements['test']->setValue('Fred'); + + +// wrap it with something +$elements['test']->prefix = '******'; +$elements['test']->suffix = '!!!!!!'; + +$form->output(new StdClass, $elements); + +// in the example below, the new data you have added is to the existing attributes ]]> </programlisting> </example> - + <example> - <title>an input tag in template</title> + <title>template example</title> <programlisting role="html"> - <![CDATA[ - -<form name="theform"> -<input name="theinput"> -</form> + <![CDATA[ +<BODY> + <FORM name="XXXX" flexy:ignoreonly="yes"> + + <INPUT name="test" length="12"> + + + </FORM> +</BODY> + ]]> </programlisting> </example> - - <example> - <title>Compiled template</title> - <programlisting role="html"> + + <example> + <title>compiled template</title> + <programlisting role="php"> <![CDATA[ - -<FORM NAME="theform"> -<INPUT NAME="theinput" VALUE="<?php echo htmlspecialchars($t->theform->theinput); ?>"><?php - if (isset($this->errors['theform.theinput'])) { echo htmlspecialchars($this->errors['theform.theinput']); } ?> -</FORM> +<BODY> + <FORM name="XXXX"> + + <?php echo $this->elements['test']->toHtml();?> + + + </FORM> +</BODY> + - ]]> </programlisting> </example> - - <example> - <title>Simple ouput example</title> + + <example> + <title>output from the Template</title> <programlisting role="html"> - <![CDATA[ - -** well since I cant show forms, It will look something like this.. - -[hello world] + <![CDATA[ +<BODY> + <FORM name="XXXX"> + + ******<INPUT name="test" length="12" class="bold" value="Fred">!!!!!! + + + </FORM> +</BODY> - -]]> +]]> </programlisting> </example> - </refsect1> - + + </refsect1> http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/attribute/select.xml?r1=1.4&r2=1.5&ty=u Index: peardoc/en/package/html/html-template-flexy/attribute/select.xml diff -u peardoc/en/package/html/html-template-flexy/attribute/select.xml:1.4 peardoc/en/package/html/html-template-flexy/attribute/select.xml:1.5 --- peardoc/en/package/html/html-template-flexy/attribute/select.xml:1.4 Mon May 12 16:46:12 2003 +++ peardoc/en/package/html/html-template-flexy/attribute/select.xml Thu Jan 29 11:32:26 2004 @@ -1,7 +1,7 @@ -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry id="package.html.html-template-flexy.attribute.select"> <refnamediv> - <refname>&lt;SELECT NAME="name"&gt;</refname> + <refname>&lt;SELECT NAME=&quot;name&quot;&gt;</refname> <refpurpose>creates PHP variable and code for select lists</refpurpose> </refnamediv> <refsynopsisdiv> @@ -10,9 +10,8 @@ <funcprototype> <funcdef> <function>Usage</function></funcdef> - <paramdef><parameter>&lt;SELECT NAME="name"&gt;</parameter></paramdef> - <paramdef><parameter>&lt;SELECT NAME="name" static="TRUE"&gt;</parameter></paramdef> - <paramdef><parameter>&lt;SELECT NAME="name" flexyignore="TRUE"&gt;</parameter></paramdef> + <paramdef>&lt;<parameter>SELECT NAME=&quot;name&quot;</parameter>&gt;</paramdef> + </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -27,110 +26,92 @@ </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example"> - &title.example; + &title.example; <example> - <title>Setting variables for input</title> - <programlisting role="html"> - <![CDATA[ + <title>Using an element to change a template.</title> + <programlisting role="php"> + <![CDATA[ -// data object +$form = new HTML_Template_Flexy(); +$form->compile($this->masterTemplate); -class example_data { - var $theselect = 1; - - function getOptions($what) { - switch ($what) { - case "theselect": - return array( - 1 => 'One', - 2 => 'Two' - ); - default: - return array( - '-' => 'Error select not supported' - ) - } - } -} - -........ - -$this->theform = new example_data; -$this->theform->theselect = 1; -$this->theform->theselect_a = 'dogs'; -$template->outputObject($this); -........ +// create an instance (note you dont have to specify any details..) + +// select options +$elements['test_select'] = new HTML_Template_Flexy_Element; +$elements['test_select']->setOptions( array( + '123' => 'a select option' + '1234' => 'another select option' +)); +$elements['test_select']->setValue('1234'); + + +$form->output(new StdClass, $elements); + +// in the example below, the new data you have added is to the existing attributes ]]> </programlisting> </example> - + <example> - <title>Foreach in template</title> + <title>template example</title> <programlisting role="html"> - <![CDATA[ - -<form name="theform"> - <SELECT name="theselect"> - <option>example</option> - </SELECT> - <SELECT name="theselect_a" static="TRUE"> - <option>dogs</option> - <option>cats</option> - </SELECT> -</form> + <![CDATA[ +<BODY> + <FORM name="theform" flexy:ignoreonly="yes"> + <SELECT name="test_select"></SELECT> + + + </FORM> +</BODY> + ]]> </programlisting> </example> + - <example> - <title>Compiled template</title> - <programlisting role="html"> + <example> + <title>compiled template</title> + <programlisting role="php"> <![CDATA[ - - -<FORM NAME="theform"> - <SELECT NAME="theselect"><?php if (method_exists($t->theform,'getOptions')) - foreach($t->theform->getOptions('theselect') as $_k=>$_v) { - printf("<OPTION VALUE=\"%s\"%s>%s</OPTION>", - htmlspecialchars($_k), - ($_k == $t->theform->theselect) ? ' SELECTED' : '', - htmlspecialchars($_v) - ); } ?></SELECT> - <SELECT NAME="theselect_a" STATIC="TRUE"> - <OPTION <? if ($t->theform->theselect_a == "dogs") echo ' SELECTED';?>>dogs</OPTION> - <OPTION <? if ($t->theform->theselect_a == "cats") echo ' SELECTED';?>>cats</OPTION> - </SELECT> -</FORM> +<BODY> + <FORM name="theform"> + + <?php echo $this->elements['test_select']->toHtml();?> + + + </FORM> +</BODY> + - - - - ]]> </programlisting> </example> - - <example> - <title>Simple ouput example</title> + + <example> + <title>output from the Template</title> <programlisting role="html"> - <![CDATA[ + <![CDATA[ +<BODY> + <FORM name="theform"> + + + <SELECT name="test_select"> + <option value="123">a selection option</option> + <option value="1234" selected>another selection option</option> - - -** well since I cant show forms, It will look something like this.. - -[One v] - -[dogs v] - + </SELECT> + + </FORM> +</BODY> - -]]> +]]> </programlisting> </example> - </refsect1> + + </refsect1> http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/attribute/textarea.xml?r1=1.7&r2=1.8&ty=u Index: peardoc/en/package/html/html-template-flexy/attribute/textarea.xml diff -u peardoc/en/package/html/html-template-flexy/attribute/textarea.xml:1.7 peardoc/en/package/html/html-template-flexy/attribute/textarea.xml:1.8 --- peardoc/en/package/html/html-template-flexy/attribute/textarea.xml:1.7 Mon May 12 16:40:30 2003 +++ peardoc/en/package/html/html-template-flexy/attribute/textarea.xml Thu Jan 29 11:32:26 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry id="package.html.html-template-flexy.attribute.textarea"> <refnamediv> <refname>&lt;TEXTAREA NAME="name"&gt;</refname> @@ -10,8 +10,8 @@ <funcprototype> <funcdef> <function>Usage</function></funcdef> - <paramdef><parameter>&lt;TEXTAREA NAME="name"&gt;</parameter></paramdef> - <paramdef><parameter>&lt;TEXTAREA NAME="name" flexyignore="TRUE"&gt;</parameter></paramdef> + <paramdef>&lt;<parameter>TEXTAREA NAME=&quot;name&quot;</parameter>&gt;</paramdef> + </funcprototype> </funcsynopsis> </refsynopsisdiv> @@ -30,66 +30,86 @@ <refsect1 id="package.html.html-template-flexy.attribute.textarea.example"> &title.example; <example> - <title>Setting variables for input</title> - <programlisting role="html"> + <title>Using an element to change a template.</title> + <programlisting role="php"> <![CDATA[ -$this->theform = new StdClass; -// or you can use a DataObject! -$this->theform->theinput = "hello world"; +$form = new HTML_Template_Flexy(); +$form->compile($this->masterTemplate); -]]> - </programlisting> - </example> +// create an instance (note you dont have to specify any details..) - <example> - <title>textarea in template</title> - <programlisting role="html"> - <![CDATA[ - -<form name="theform"> -<TEXTAREA name="theinput">some dummy text</TEXTAREA> -</form> +$elements['test'] = new HTML_Template_Flexy_Element; + +// change an attribute +$elements['test']->attributes['class'] = 'bold'; + +// sets the value +$elements['test']->setValue('Fred'); + + +$form->output(new StdClass, $elements); + +// in the example below, the new data you have added is to the existing attributes ]]> </programlisting> </example> <example> - <title>Compiled template</title> + <title>template example</title> <programlisting role="html"> <![CDATA[ - -<FORM NAME="theform"> -<TEXTAREA NAME="theinput"><?php echo htmlspecialchars($t->theform->theinput); ?></TEXTAREA> - <?php if (isset($this->errors['theform.theinput'])) { - echo htmlspecialchars($this->errors['theform.theinput']); } ?> -</FORM> +<BODY> + <FORM name="XXXX" flexy:ignoreonly="yes"> + + <textarea name="test"></textarea> + + + </FORM> +</BODY> - ]]> </programlisting> </example> - - <example> - <title>Simple ouput example</title> - <programlisting role="html"> + + <example> + <title>compiled template</title> + <programlisting role="php"> <![CDATA[ - - - -** well since I cant show forms, It will look something like this.. +<BODY> + <FORM name="XXXX"> + + <?php echo $this->elements['test']->toHtml();?> + + + </FORM> +</BODY> -[hello world ] -[ ] -[ ] - ]]> </programlisting> </example> - </refsect1> + + <example> + <title>output from the Template</title> + <programlisting role="html"> + <![CDATA[ +<BODY> + <FORM name="XXXX"> + + <textarea name="test" class="bold">Fred</textarea> + + + </FORM> +</BODY> + +]]> + </programlisting> + </example> + + </refsect1>
« previous php.pear.doc (#2257) next »