cvs: peardoc /en/package/html/html-template-flexy/element html_template_flexy_element.xml
| From: | Alan Knowles | Date: | Thu, 29 Jan 2004 15:46:08 +0000 |
| Subject: | cvs: peardoc /en/package/html/html-template-flexy/element html_template_flexy_element.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-2255@lists.php.net to get a copy of this message | ||
alan_k Thu Jan 29 10:46:08 2004 EDT
Modified files:
/peardoc/en/package/html/html-template-flexy/element
html_template_flexy_element.xml
Log:
add some docs to element
http://cvs.php.net/diff.php/peardoc/en/package/html/html-template-flexy/element/html_template_flexy_element.xml?r1=1.6&r2=1.7&ty=u
Index: peardoc/en/package/html/html-template-flexy/element/html_template_flexy_element.xml
diff -u peardoc/en/package/html/html-template-flexy/element/html_template_flexy_element.xml:1.6
peardoc/en/package/html/html-template-flexy/element/html_template_flexy_element.xml:1.7
--- peardoc/en/package/html/html-template-flexy/element/html_template_flexy_element.xml:1.6 Wed Aug
13 12:01:03 2003
+++ peardoc/en/package/html/html-template-flexy/element/html_template_flexy_element.xml Thu Jan 29
10:46:08 2004
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
@@ -190,6 +190,137 @@
&title.note;
¬e.notstatic;
</refsect1>
+
+
+ <refsect1
id="package.html.html-template-flexy.element.html-template-flexy-element.example">
+ &title.example;
+ <example>
+ <title>Using an element to change a template.</title>
+ <programlisting role="php">
+ <![CDATA[
+
+$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 = '!!!!!!';
+
+
+
+// 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>template example</title>
+ <programlisting role="html">
+ <![CDATA[
+<BODY>
+ <FORM name="XXXX">
+
+ <INPUT name="test" length="12">
+
+ <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>output from the Template</title>
+ <programlisting role="html">
+ <![CDATA[
+<BODY>
+ <FORM name="XXXX">
+
+ ******<INPUT name="test" length="12" class="bold"
value="Fred">!!!!!!
+
+ <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>
+
+ </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>
+
+]]>
+ </programlisting>
+ </example>
+
+
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
Local variables: