cvs: peardoc /peardoc2/en/package/html/html-template-flexy configuration.xml intro.xml
/peardoc2/en/package/html/html-template-flexy/html-template-flexy bufferedoutputobject.xml compile.xml html-template-flexy.xml outputobject.xml
/peardoc2/en/package/html/html-template-flexy/tag else.xml end.xml foreach.xml if.xml method.xml variable.xml
| From: | Alan Knowles | Date: | Sun, 02 Feb 2003 14:41:39 +0000 |
| Subject: | cvs: peardoc /peardoc2/en/package/html/html-template-flexy configuration.xml intro.xml /peardoc2/en/package/html/html-template-flexy/html-template-flexy bufferedoutputobject.xml compile.xml html-template-flexy.xml outputobject.xml /peardoc2/en/package/html/html-template-flexy/tag else.xml end.xml foreach.xml if.xml method.xml variable.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-361@lists.php.net to get a copy of this message | ||
alan_k Sun Feb 2 09:41:39 2003 EDT
Modified files:
/peardoc/peardoc2/en/package/html/html-template-flexy
configuration.xml
intro.xml
/peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy
bufferedoutputobject.xml
compile.xml
html-template-flexy.xml
outputobject.xml
/peardoc/peardoc2/en/package/html/html-template-flexy/tag else.xml
end.xml
foreach.xml
if.xml
method.xml
variable.xml
Log:
more tidying up of text examples, etc.
Index: peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml:1.2 Sat Feb 1 12:51:12 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml Sun Feb 2 09:41:39 2003 @@ -22,11 +22,9 @@ <refsect1> <title>Configuration</title> <para> - <classname>HTML_Template_Flexy</classname> can either be configured - globally or on each instance, using an associated array. - The easiest way to configure <classname>HTML_Template_Flexy</classname> - is to use ini files (although you may also like to consider - the <classname>PEAR::Config</classname> class, or your own configuration system) + HTML_Template_Flexy can either be configured globally or on each instance, using an associated array. + The easiest way to configure HTML_Template_Flexy is to use ini files (although you may also like to consider + the PEAR::Config class, or your own configuration system) </para> <example> @@ -39,12 +37,12 @@ compileDir = /home/me/Projects/myapplication/compiled_templates forceCompile = 0 debug = 0 +locale = en </programlisting> </example> <para> - To use this ini file with <classname>HTML_Template_Flexy</classname>, - (and possibly any other classes that use options like this) + To use this ini file with HTML_Template_Flexy, (and Possibly any other classes that use options like this) </para> <example> <title> Setting the default options</title> @@ -70,7 +68,8 @@ 'templateDir' => '/home/me/Projects/myapplication/templates', 'compileDir' => '/home/me/Projects/myapplication/compiled_templates', 'forceCompile' => 0, - 'debug' => 0 + 'debug' => 0, + 'locale' = 'en' ); $template = new HTML_Template_Flexy($options); ?> @@ -150,6 +149,18 @@ </listitem> </varlistentry> + <varlistentry> + <term> + <parameter>locale</parameter> + <type>string</type> + </term> + <listitem> + <para> + Default is 'en' - english. The language use for reading/writing templates. + Currently it is only used in the compiled files filename = eg. originalname.html.en.php + </para> + </listitem> + </varlistentry> </variablelist> Index: peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.3 peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.4 --- peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.3 Sun Feb 2 04:58:16 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml Sun Feb 2 09:41:39 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-template-flexy.intro"> <refnamediv> <refname>Introduction</refname> @@ -30,11 +30,11 @@ linkend="package.php.phpdoc">PHPDoc</link> comments around object variables</para> </listitem> <listitem> - <simpara>Ability to edit the templates in WYSIWYG editors, without breaking the tags</simpara> + <simpara>Ability to edit the templates in WYSIWYG HTML editors, without breaking the tags</simpara> </listitem> <listitem> - <simpara>Fast and Easy to use looping, both for designing and runtime</simpara> - </listitem> + <simpara>Fast and Easy to do looping (or blocks), both for designing and runtime</simpara> + </listitem> </itemizedlist> </para> @@ -42,8 +42,8 @@ <refsect1> <title>How does HTML_Template_Flexy differ from other template systems</title> <para> - If you look around you will see there are other template systems available in PHP, they generally fall into two - categories, Replacement Systems, or PHP Code builders. + If you look around you will see there are other template systems available in PHP, they + generally fall into two categories, Replacement Systems, or PHP Code builders. </para> <para> Replacement systems like <link @@ -66,8 +66,8 @@ <title>Typical use example</title> <para> Flexy template is normally called from within a Controller Class (in the Model,View,Controller paragam). - Note that you just send <classname>HTML_Template_Flexy</classname>, the name of the template, and the class to output. - any - variable you want printing out just have to be set in the object being sent to it. + You just send <classname>HTML_Template_Flexy</classname>, the name of the template, and the object to output. + - any variable you want printing out just has to be set in the object being used to ouput. </para> <example> @@ -89,9 +89,11 @@ { var $template = "home.html"; // name of template - var $title; // page title; - var $numbers = array(); // an array example - var $form; + var $title; // this relates to {title}; + var $numbers = array(); // this relates to {numbers} , used with foreach + var $form; // this relates to the form elements object + + /* start section - deals with posts, get variables etc.*/ function controller_test() @@ -105,7 +107,11 @@ { $this->title = "Hello World"; + + // use a object for the form (or use a dataobject) $this->form = new StdClass; + + // assign the default value for the form element. $this->form->input = "Hello"; for ($i = 1;$i< 5;$i++) { @@ -154,11 +160,16 @@ Input Box: <input name="input"> </td> </tr> + + <!-- note here the use for foreach as an attribute value --> + <tr foreach="numbers,number,string"> <td> <a href="mypage.html?id=%7Bnumber%7D">{string}</a> </td> </tr> + + </table> </body> </html> Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml:1.2 Sun Feb 2 08:42:03 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.bufferedoutputobject"> <refnamediv> <refname>->bufferedOutputObject()</refname> @@ -63,7 +63,7 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.bufferedoutputobject.example"> &title.example; <example> - <title>Simple output example</title> + <title>Person DataObject send_password method</title> <programlisting role="php"> <![CDATA[ @@ -98,7 +98,7 @@ </example> <example> - <title>Simple template example</title> + <title>An email template</title> <programlisting role="html"> <![CDATA[ From: "HTML_Template_Flexy" <html_template_flexy@pear.php.net> @@ -120,7 +120,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The resulting email head and body</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml:1.2 Sun Feb 2 08:42:03 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml Sun Feb 2 09:41:39 2003 @@ -1,15 +1,15 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.compile"> <refnamediv> <refname>->compile()</refname> - <refpurpose>Converts template from markup to PHP if required</refpurpose> + <refpurpose>Converts a template from markup to PHP if required</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>void - <function>->compile()</function></funcdef> + <function>->compile</function></funcdef> <paramdef>string <parameter>$template</parameter></paramdef> </funcprototype> @@ -18,8 +18,9 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.compile.desc"> &title.desc; <para> - If Neccessary converts the Template markup into PHP code, and writes - it to the compiledTemplate directory. The Template is only compiled if + If nccessary it will convert the Template markup into PHP code, and writes + it to the compiledTemplate directory adding the {locale}.php to the end of the filename. + The Template is only compiled if </para> <para> <itemizedlist> @@ -105,13 +106,16 @@ function output() { $master = new HTML_Template_Flexy(); $master->compile($this->masterTemplate); - - $child = new HTML_Template_Flexy(); - $child->compile($this->template); - $master->outputObject($this); } + function outputBody() { + $body = new HTML_Template_Flexy(); + $body->compile($this->template); + $body->outputObject($this); + } + + } @@ -126,7 +130,7 @@ <![CDATA[ Page Header Goes here. -{include:template} +{outputBody()} Page Footer Goes here Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml:1.1 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml:1.2 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml:1.1 Sat Feb 1 09:10:36 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.html-template-flexy"> <refnamediv> <refname>HTML_Template_Flexy::HTML_Template_Flexy()</refname> @@ -10,8 +10,8 @@ require_once 'HTML/Template/Flexy.php'; </funcsynopsisinfo> <funcprototype> - <funcdef>void - <function>HTML_Template_Flexy::HTML_Template_Flexy</function></funcdef> + <funcdef>new + <function>HTML_Template_Flexy</function></funcdef> <paramdef>array <parameter><optional>$options</optional></parameter></paramdef> </funcprototype> @@ -20,8 +20,8 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.html-template-flexy.desc"> &title.desc; <para> - Constructor, normally, you do not need to provide any options, as they are - set by the PEAR::getStaticPropery(), as described in the configuration. + The Object Constructor accepts options as it's arguments. Normally, you do not need to provide any options, + as they are set by the PEAR::getStaticPropery(), as described in the configuration. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.html-template-flexy.html-template-flexy.parameter"> @@ -39,7 +39,7 @@ </refsect1> <refsect1 id="package.html.html-template-flexy.html-template-flexy.html-template-flexy.note"> &title.note; - ¬e.canstatic; + ¬e.notstatic; </refsect1> </refentry> <!-- Keep this comment at the end of the file Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml:1.2 Sun Feb 2 08:42:03 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.outputobject"> <refnamediv> <refname>->outputObject()</refname> @@ -44,7 +44,7 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.outputobject.example"> &title.example; <example> - <title>Simple output example</title> + <title>PHP code initiating the template, and outputing it</title> <programlisting role="php"> <![CDATA[ @@ -63,7 +63,7 @@ </example> <example> - <title>Simple template example</title> + <title>The Template with some tags</title> <programlisting role="html"> <![CDATA[ <B>{tag}</B> @@ -73,7 +73,7 @@ </programlisting> </example> <example> - <title>Simple ouput example</title> + <title>Resulting output</title> <programlisting role="html"> <![CDATA[ <B>>> hello world</B> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.else"> <refnamediv> <refname>{else:}</refname> @@ -72,7 +72,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The output</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.end"> <refnamediv> <refname>{end:}</refname> @@ -55,7 +55,7 @@ </example> <example> - <title>Foreach in template</title> + <title>The template</title> <programlisting role="html"> <![CDATA[ @@ -67,7 +67,7 @@ </example> <example> - <title>Compiled template</title> + <title>The compiled template</title> <programlisting role="html"> <![CDATA[ @@ -80,7 +80,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The output</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.foreach"> <refnamediv> <refname>{foreach:variable,key,value}</refname> @@ -18,7 +18,8 @@ <refsect1 id="package.html.html-template-flexy.tag.foreach.desc"> &title.desc; <para> - creates a foreach loop, needs and {end:} tag. + creates a foreach loop, needs an {end:} tag. note that the engine will add the variable to the scope, + so they will not be prefixed with $t-> when used inside the loop. </para> @@ -95,10 +96,10 @@ <![CDATA[ <?php if (is_array($t->a)) foreach($t->a as $k => $v) { ?> - k is <?php echo htmlspecialchars($t->k); ?>, and v is <?php echo htmlspecialchars($t->v); ?> + k is <?php echo htmlspecialchars($k); ?>, and v is <?php echo htmlspecialchars($v); ?> <?php } ?> <?php if (is_array($t->a)) foreach($t->b as $v) { ?> - v is <?php echo htmlspecialchars($t->v); ?> + v is <?php echo htmlspecialchars($v); ?> <?php } ?> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.if"> <refnamediv> <refname>{if:variable}</refname> @@ -55,7 +55,7 @@ </example> <example> - <title>Foreach in template</title> + <title>The template</title> <programlisting role="html"> <![CDATA[ @@ -80,7 +80,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The output</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.method"> <refnamediv> <refname>{method(arguments,#quoted arguments#)}</refname> @@ -52,6 +52,10 @@ var $masterTemplate = "master.html"; var $bodyTemplate = "body.html"; + function ucfirst($string) { + echo ucfirst($string); + } + function includeBody() { $template = new HTML_Template_Flexy(); $template->compile($this->bodyTemplate); @@ -64,11 +68,11 @@ </example> <example> - <title>Calling includeBody in template</title> + <title>Calling includeBody in template, and ucfirst</title> <programlisting role="html"> <![CDATA[ -Header Goes Here. +{ucfirst(#this is the header#)} {includeBody()} @@ -83,7 +87,7 @@ <programlisting role="html"> <![CDATA[ -Header Goes Here. +<?php echo htmlspecialchars($t->ucfirst("this is the header")); ?> <?php echo htmlspecialchars($t->includeBody()); ?> @@ -94,16 +98,12 @@ ]]> </programlisting> </example> - </refsect1> - - - <refsect1 id="package.html.html-template-flexy.tag.method.example.output"> - &title.example; + <example> - <title>Simple output example</title> + <title>Output from the code</title> <programlisting role="html"> <![CDATA[ -Header Goes Here. +This is the header Hello World Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.3 peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.4 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.3 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-template-flexy.tag.variable"> <refnamediv> <refname>{variable}</refname> @@ -19,7 +19,7 @@ <refsect1 id="package.html.html-template-flexy.tag.variable.desc"> &title.desc; <para> - creates an echo variable, with optional modifier. Modifiers area + creates an echo variable, with optional modifier. Modifiers are </para> <para> <itemizedlist>
Index: peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml:1.2 Sat Feb 1 12:51:12 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/configuration.xml Sun Feb 2 09:41:39 2003 @@ -22,11 +22,9 @@ <refsect1> <title>Configuration</title> <para> - <classname>HTML_Template_Flexy</classname> can either be configured - globally or on each instance, using an associated array. - The easiest way to configure <classname>HTML_Template_Flexy</classname> - is to use ini files (although you may also like to consider - the <classname>PEAR::Config</classname> class, or your own configuration system) + HTML_Template_Flexy can either be configured globally or on each instance, using an associated array. + The easiest way to configure HTML_Template_Flexy is to use ini files (although you may also like to consider + the PEAR::Config class, or your own configuration system) </para> <example> @@ -39,12 +37,12 @@ compileDir = /home/me/Projects/myapplication/compiled_templates forceCompile = 0 debug = 0 +locale = en </programlisting> </example> <para> - To use this ini file with <classname>HTML_Template_Flexy</classname>, - (and possibly any other classes that use options like this) + To use this ini file with HTML_Template_Flexy, (and Possibly any other classes that use options like this) </para> <example> <title> Setting the default options</title> @@ -70,7 +68,8 @@ 'templateDir' => '/home/me/Projects/myapplication/templates', 'compileDir' => '/home/me/Projects/myapplication/compiled_templates', 'forceCompile' => 0, - 'debug' => 0 + 'debug' => 0, + 'locale' = 'en' ); $template = new HTML_Template_Flexy($options); ?> @@ -150,6 +149,18 @@ </listitem> </varlistentry> + <varlistentry> + <term> + <parameter>locale</parameter> + <type>string</type> + </term> + <listitem> + <para> + Default is 'en' - english. The language use for reading/writing templates. + Currently it is only used in the compiled files filename = eg. originalname.html.en.php + </para> + </listitem> + </varlistentry> </variablelist> Index: peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.3 peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.4 --- peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.3 Sun Feb 2 04:58:16 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml Sun Feb 2 09:41:39 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-template-flexy.intro"> <refnamediv> <refname>Introduction</refname> @@ -30,11 +30,11 @@ linkend="package.php.phpdoc">PHPDoc</link> comments around object variables</para> </listitem> <listitem> - <simpara>Ability to edit the templates in WYSIWYG editors, without breaking the tags</simpara> + <simpara>Ability to edit the templates in WYSIWYG HTML editors, without breaking the tags</simpara> </listitem> <listitem> - <simpara>Fast and Easy to use looping, both for designing and runtime</simpara> - </listitem> + <simpara>Fast and Easy to do looping (or blocks), both for designing and runtime</simpara> + </listitem> </itemizedlist> </para> @@ -42,8 +42,8 @@ <refsect1> <title>How does HTML_Template_Flexy differ from other template systems</title> <para> - If you look around you will see there are other template systems available in PHP, they generally fall into two - categories, Replacement Systems, or PHP Code builders. + If you look around you will see there are other template systems available in PHP, they + generally fall into two categories, Replacement Systems, or PHP Code builders. </para> <para> Replacement systems like <link @@ -66,8 +66,8 @@ <title>Typical use example</title> <para> Flexy template is normally called from within a Controller Class (in the Model,View,Controller paragam). - Note that you just send <classname>HTML_Template_Flexy</classname>, the name of the template, and the class to output. - any - variable you want printing out just have to be set in the object being sent to it. + You just send <classname>HTML_Template_Flexy</classname>, the name of the template, and the object to output. + - any variable you want printing out just has to be set in the object being used to ouput. </para> <example> @@ -89,9 +89,11 @@ { var $template = "home.html"; // name of template - var $title; // page title; - var $numbers = array(); // an array example - var $form; + var $title; // this relates to {title}; + var $numbers = array(); // this relates to {numbers} , used with foreach + var $form; // this relates to the form elements object + + /* start section - deals with posts, get variables etc.*/ function controller_test() @@ -105,7 +107,11 @@ { $this->title = "Hello World"; + + // use a object for the form (or use a dataobject) $this->form = new StdClass; + + // assign the default value for the form element. $this->form->input = "Hello"; for ($i = 1;$i< 5;$i++) { @@ -154,11 +160,16 @@ Input Box: <input name="input"> </td> </tr> + + <!-- note here the use for foreach as an attribute value --> + <tr foreach="numbers,number,string"> <td> <a href="mypage.html?id=%7Bnumber%7D">{string}</a> </td> </tr> + + </table> </body> </html> Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml:1.2 Sun Feb 2 08:42:03 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/bufferedoutputobject.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.bufferedoutputobject"> <refnamediv> <refname>->bufferedOutputObject()</refname> @@ -63,7 +63,7 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.bufferedoutputobject.example"> &title.example; <example> - <title>Simple output example</title> + <title>Person DataObject send_password method</title> <programlisting role="php"> <![CDATA[ @@ -98,7 +98,7 @@ </example> <example> - <title>Simple template example</title> + <title>An email template</title> <programlisting role="html"> <![CDATA[ From: "HTML_Template_Flexy" <html_template_flexy@pear.php.net> @@ -120,7 +120,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The resulting email head and body</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml:1.2 Sun Feb 2 08:42:03 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/compile.xml Sun Feb 2 09:41:39 2003 @@ -1,15 +1,15 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.compile"> <refnamediv> <refname>->compile()</refname> - <refpurpose>Converts template from markup to PHP if required</refpurpose> + <refpurpose>Converts a template from markup to PHP if required</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>void - <function>->compile()</function></funcdef> + <function>->compile</function></funcdef> <paramdef>string <parameter>$template</parameter></paramdef> </funcprototype> @@ -18,8 +18,9 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.compile.desc"> &title.desc; <para> - If Neccessary converts the Template markup into PHP code, and writes - it to the compiledTemplate directory. The Template is only compiled if + If nccessary it will convert the Template markup into PHP code, and writes + it to the compiledTemplate directory adding the {locale}.php to the end of the filename. + The Template is only compiled if </para> <para> <itemizedlist> @@ -105,13 +106,16 @@ function output() { $master = new HTML_Template_Flexy(); $master->compile($this->masterTemplate); - - $child = new HTML_Template_Flexy(); - $child->compile($this->template); - $master->outputObject($this); } + function outputBody() { + $body = new HTML_Template_Flexy(); + $body->compile($this->template); + $body->outputObject($this); + } + + } @@ -126,7 +130,7 @@ <![CDATA[ Page Header Goes here. -{include:template} +{outputBody()} Page Footer Goes here Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml:1.1 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml:1.2 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml:1.1 Sat Feb 1 09:10:36 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/html-template-flexy.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.html-template-flexy"> <refnamediv> <refname>HTML_Template_Flexy::HTML_Template_Flexy()</refname> @@ -10,8 +10,8 @@ require_once 'HTML/Template/Flexy.php'; </funcsynopsisinfo> <funcprototype> - <funcdef>void - <function>HTML_Template_Flexy::HTML_Template_Flexy</function></funcdef> + <funcdef>new + <function>HTML_Template_Flexy</function></funcdef> <paramdef>array <parameter><optional>$options</optional></parameter></paramdef> </funcprototype> @@ -20,8 +20,8 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.html-template-flexy.desc"> &title.desc; <para> - Constructor, normally, you do not need to provide any options, as they are - set by the PEAR::getStaticPropery(), as described in the configuration. + The Object Constructor accepts options as it's arguments. Normally, you do not need to provide any options, + as they are set by the PEAR::getStaticPropery(), as described in the configuration. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.html-template-flexy.html-template-flexy.parameter"> @@ -39,7 +39,7 @@ </refsect1> <refsect1 id="package.html.html-template-flexy.html-template-flexy.html-template-flexy.note"> &title.note; - ¬e.canstatic; + ¬e.notstatic; </refsect1> </refentry> <!-- Keep this comment at the end of the file Index: peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml:1.2 Sun Feb 2 08:42:03 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/html-template-flexy/outputobject.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.html-template-flexy.outputobject"> <refnamediv> <refname>->outputObject()</refname> @@ -44,7 +44,7 @@ <refsect1 id="package.html.html-template-flexy.html-template-flexy.outputobject.example"> &title.example; <example> - <title>Simple output example</title> + <title>PHP code initiating the template, and outputing it</title> <programlisting role="php"> <![CDATA[ @@ -63,7 +63,7 @@ </example> <example> - <title>Simple template example</title> + <title>The Template with some tags</title> <programlisting role="html"> <![CDATA[ <B>{tag}</B> @@ -73,7 +73,7 @@ </programlisting> </example> <example> - <title>Simple ouput example</title> + <title>Resulting output</title> <programlisting role="html"> <![CDATA[ <B>>> hello world</B> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.else"> <refnamediv> <refname>{else:}</refname> @@ -72,7 +72,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The output</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.end"> <refnamediv> <refname>{end:}</refname> @@ -55,7 +55,7 @@ </example> <example> - <title>Foreach in template</title> + <title>The template</title> <programlisting role="html"> <![CDATA[ @@ -67,7 +67,7 @@ </example> <example> - <title>Compiled template</title> + <title>The compiled template</title> <programlisting role="html"> <![CDATA[ @@ -80,7 +80,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The output</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/foreach.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.foreach"> <refnamediv> <refname>{foreach:variable,key,value}</refname> @@ -18,7 +18,8 @@ <refsect1 id="package.html.html-template-flexy.tag.foreach.desc"> &title.desc; <para> - creates a foreach loop, needs and {end:} tag. + creates a foreach loop, needs an {end:} tag. note that the engine will add the variable to the scope, + so they will not be prefixed with $t-> when used inside the loop. </para> @@ -95,10 +96,10 @@ <![CDATA[ <?php if (is_array($t->a)) foreach($t->a as $k => $v) { ?> - k is <?php echo htmlspecialchars($t->k); ?>, and v is <?php echo htmlspecialchars($t->v); ?> + k is <?php echo htmlspecialchars($k); ?>, and v is <?php echo htmlspecialchars($v); ?> <?php } ?> <?php if (is_array($t->a)) foreach($t->b as $v) { ?> - v is <?php echo htmlspecialchars($t->v); ?> + v is <?php echo htmlspecialchars($v); ?> <?php } ?> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.if"> <refnamediv> <refname>{if:variable}</refname> @@ -55,7 +55,7 @@ </example> <example> - <title>Foreach in template</title> + <title>The template</title> <programlisting role="html"> <![CDATA[ @@ -80,7 +80,7 @@ </example> <example> - <title>Simple ouput example</title> + <title>The output</title> <programlisting role="html"> <![CDATA[ Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml:1.2 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.tag.method"> <refnamediv> <refname>{method(arguments,#quoted arguments#)}</refname> @@ -52,6 +52,10 @@ var $masterTemplate = "master.html"; var $bodyTemplate = "body.html"; + function ucfirst($string) { + echo ucfirst($string); + } + function includeBody() { $template = new HTML_Template_Flexy(); $template->compile($this->bodyTemplate); @@ -64,11 +68,11 @@ </example> <example> - <title>Calling includeBody in template</title> + <title>Calling includeBody in template, and ucfirst</title> <programlisting role="html"> <![CDATA[ -Header Goes Here. +{ucfirst(#this is the header#)} {includeBody()} @@ -83,7 +87,7 @@ <programlisting role="html"> <![CDATA[ -Header Goes Here. +<?php echo htmlspecialchars($t->ucfirst("this is the header")); ?> <?php echo htmlspecialchars($t->includeBody()); ?> @@ -94,16 +98,12 @@ ]]> </programlisting> </example> - </refsect1> - - - <refsect1 id="package.html.html-template-flexy.tag.method.example.output"> - &title.example; + <example> - <title>Simple output example</title> + <title>Output from the code</title> <programlisting role="html"> <![CDATA[ -Header Goes Here. +This is the header Hello World Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.3 peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.4 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.3 Sun Feb 2 08:37:37 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml Sun Feb 2 09:41:39 2003 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.html.html-template-flexy.tag.variable"> <refnamediv> <refname>{variable}</refname> @@ -19,7 +19,7 @@ <refsect1 id="package.html.html-template-flexy.tag.variable.desc"> &title.desc; <para> - creates an echo variable, with optional modifier. Modifiers area + creates an echo variable, with optional modifier. Modifiers are </para> <para> <itemizedlist>