cvs: peardoc /peardoc2/en/package/html/html-template-flexy intro.xml /peardoc2/en/package/html/html-template-flexy/attribute select.xml
/peardoc2/en/package/html/html-template-flexy/tag else.xml end.xml if.xml method.xml variable.xml
| From: | Alan Knowles | Date: | Sun, 02 Feb 2003 09:58:16 +0000 |
| Subject: | cvs: peardoc /peardoc2/en/package/html/html-template-flexy intro.xml /peardoc2/en/package/html/html-template-flexy/attribute select.xml /peardoc2/en/package/html/html-template-flexy/tag else.xml end.xml if.xml method.xml variable.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-350@lists.php.net to get a copy of this message | ||
alan_k Sun Feb 2 04:58:16 2003 EDT
Added files:
/peardoc/peardoc2/en/package/html/html-template-flexy/attribute
select.xml
/peardoc/peardoc2/en/package/html/html-template-flexy/tag else.xml
end.xml
if.xml
method.xml
Modified files:
/peardoc/peardoc2/en/package/html/html-template-flexy intro.xml
/peardoc/peardoc2/en/package/html/html-template-flexy/tag
variable.xml
Log:
more tags and attributes documented
Index: peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.2 Sat Feb 1 12:51:12 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml Sun Feb 2 04:58:16 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.intro"> <refnamediv> <refname>Introduction</refname> @@ -13,13 +13,13 @@ HTML_Template_Flexy started it's life as a simplification of HTML_Template_Xipe, however in Version 0.2, It became one of the first template engines to use a real Lexer, rather than regex'es, making it possible to do things like ASP.net or Cold - Fusion tags. However, it'still has a very simple set of goals. + Fusion tags. However, it still has a very simple set of goals. </para> <para> <itemizedlist> <listitem> - <simpara>Simple API, easy to learn...</simpara> + <simpara>Very Simple API, easy to learn...</simpara> </listitem> <listitem> <simpara>Targeted at Object based systems - default behavior is to display object variables</simpara> @@ -43,7 +43,7 @@ <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. + categories, Replacement Systems, or PHP Code builders. </para> <para> Replacement systems like <link @@ -91,7 +91,7 @@ var $template = "home.html"; // name of template var $title; // page title; var $numbers = array(); // an array example - + var $form; /* start section - deals with posts, get variables etc.*/ function controller_test() @@ -103,7 +103,10 @@ function start() { - $this->title = "<Hello World>"; + $this->title = "Hello World"; + + $this->form = new StdClass; + $this->form->input = "Hello"; for ($i = 1;$i< 5;$i++) { $this->numbers[$i] = "Number $i"; @@ -143,10 +146,12 @@ <title>{title}</title> </head> <body> + <H1>{title}</H1> + <form name="form"> <table> <tr> <td> - some numbers + Input Box: <input name="input"> </td> </tr> <tr foreach="numbers,number,string"> @@ -168,8 +173,10 @@ <title>Output of example for <classname>HTML_Template_Flexy</classname></title> <programlisting role="php"> <![CDATA[ - -some numbers + +Hello World + +Input Box : [Hello ] Number 1 Number 2 Number 3 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.1 peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.2 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.1 Sat Feb 1 09:16:44 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml Sun Feb 2 04:58:16 2003 @@ -1,5 +1,5 @@ -<!-- $Revision: 1.1 $ --> -<refentry id="package.html.html-template.tag.variable"> +<!-- $Revision: 1.2 $ --> +<refentry id="package.html.html-template-flexy.tag.variable"> <refnamediv> <refname>{variable}</refname> <refpurpose>creates a PHP echo variable</refpurpose> Index: peardoc/peardoc2/en/package/html/html-template-flexy/attribute/select.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/attribute/select.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.attribute.select"> <refnamediv> <refname><SELECT NAME="name"></refname> <refpurpose>creates PHP variable and code for select lists</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter><SELECT NAME="name"></parameter></paramdef> <paramdef><parameter><SELECT NAME="name" static="TRUE"></parameter></paramdef> <paramdef><parameter><SELECT NAME="name" flexyignore="TRUE"></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.attribute.select.desc"> &title.desc; <para> fills in the select values based on the form name and the tag name. If flexyignore is used, it is left alone. If static is set, the currently defined options will be used. And code added to check if the object variable matches them. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.php"> &title.example; <example> <title>Setting variables for input</title> <programlisting role="html"> <![CDATA[ // data object 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); ........ ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.html"> &title.example; <example> <title>Foreach in template</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> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![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> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ ** well since I cant show forms, It will look something like this.. [One v] [dogs v] ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.else"> <refnamediv> <refname>{else:}</refname> <refpurpose>adds an PHP else in an if block</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{else:}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.else.desc"> &title.desc; <para> adds a else statement in PHP so that blocks of conditional HTML are shown correctly. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.php"> &title.example; <example> <title>Setting variables for if</title> <programlisting role="html"> <![CDATA[ class example { function output() { $this->showStuff = faluse; ......... $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.html"> &title.example; <example> <title>Else in template</title> <programlisting role="html"> <![CDATA[ {if:showStuff}Hello{else:}World{end:} ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ <?php if ($t->showStuff) { ?>Hello<?php } else { ?>World<<?php } ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ World ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.end"> <refnamediv> <refname>{end:}</refname> <refpurpose>closes an if or foreach block</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{end:}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.end.desc"> &title.desc; <para> adds a closing brace in PHP so that blocks of conditional HTML are shown correctly. You do not need to use {end:} tags if you are using HTML tag attributes like IF="a,b", as the closing HTML tag will indicate that. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.php"> &title.example; <example> <title>Setting variables for if</title> <programlisting role="html"> <![CDATA[ class example { function showDog() { return true; } function output() { $this->showStuff = true; ......... $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.html"> &title.example; <example> <title>Foreach in template</title> <programlisting role="html"> <![CDATA[ {if:showStuff}Hello{end:} {if:showDog()}Doggy{end:} ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ <?php if ($t->showStuff) { ?>Hello<?php } ?> <?php if ($t->showDog()) { ?>Doggy<?php } ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ Hello Doggy ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.if"> <refnamediv> <refname>{if:variable}</refname> <refpurpose>creates a PHP if statement</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{if:variable}</parameter></paramdef> <paramdef><parameter>{if:method()}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.if.desc"> &title.desc; <para> creates a if statement, with the argument as a variable or method. You must close and if statement with and {end:} statement, and you may use {else:} with it. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.php"> &title.example; <example> <title>Setting variables for if</title> <programlisting role="html"> <![CDATA[ class example { function showDog() { return true; } function output() { $this->showStuff = true; ......... $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.html"> &title.example; <example> <title>Foreach in template</title> <programlisting role="html"> <![CDATA[ {if:showStuff}Hello{end:} {if:showDog()}Doggy{end:} ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ <?php if ($t->showStuff) { ?>Hello<?php } ?> <?php if ($t->showDog()) { ?>Doggy<?php } ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ Hello Doggy ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.method"> <refnamediv> <refname>{method(arguments,#quoted arguments#)}</refname> <refpurpose>creates a PHP method call, and echos the results</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{method()}</parameter></paramdef> <paramdef><parameter>{method():h}</parameter></paramdef> <paramdef><parameter>{method():u}</parameter></paramdef> <paramdef><parameter>{object.method()}</parameter></paramdef> <paramdef><parameter>{method(with.a.variable)}</parameter></paramdef> <paramdef><parameter>{method(with.multiple,variables)}</parameter></paramdef> <paramdef><parameter>{method(with.variables,#and strings or literals#)}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.method.desc"> &title.desc; <para> creates an PHP method call, any with any number of arguments, as variables or literals (quoted in #). the return value is echoed, and passed by a modifier (like variables) </para> <para> <itemizedlist> <listitem><simpara>No Modifier - does htmlspecialchars($variable)</simpara></listitem> <listitem><simpara>:h - echos without any change - eg. raw</simpara></listitem> <listitem><simpara>:u - echos urlencode($variable)</simpara></listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.php"> &title.example; <example> <title>Including another template</title> <programlisting role="html"> <![CDATA[ class example_page { var $masterTemplate = "master.html"; var $bodyTemplate = "body.html"; function includeBody() { $template = new HTML_Template_Flexy(); $template->compile($this->bodyTemplate); $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.html"> &title.example; <example> <title>Calling includeBody in template</title> <programlisting role="html"> <![CDATA[ Header Goes Here. {includeBody()} Footer Goes Here. ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ Header Goes Here. <?php echo htmlspecialchars($t->includeBody()); ?> Footer Goes Here. ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.output"> &title.example; <example> <title>Simple output example</title> <programlisting role="html"> <![CDATA[ Header Goes Here. Hello World Footer Goes Here. ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 -->
Index: peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml diff -u peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.2 peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.3 --- peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml:1.2 Sat Feb 1 12:51:12 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/intro.xml Sun Feb 2 04:58:16 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.html.html-template-flexy.intro"> <refnamediv> <refname>Introduction</refname> @@ -13,13 +13,13 @@ HTML_Template_Flexy started it's life as a simplification of HTML_Template_Xipe, however in Version 0.2, It became one of the first template engines to use a real Lexer, rather than regex'es, making it possible to do things like ASP.net or Cold - Fusion tags. However, it'still has a very simple set of goals. + Fusion tags. However, it still has a very simple set of goals. </para> <para> <itemizedlist> <listitem> - <simpara>Simple API, easy to learn...</simpara> + <simpara>Very Simple API, easy to learn...</simpara> </listitem> <listitem> <simpara>Targeted at Object based systems - default behavior is to display object variables</simpara> @@ -43,7 +43,7 @@ <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. + categories, Replacement Systems, or PHP Code builders. </para> <para> Replacement systems like <link @@ -91,7 +91,7 @@ var $template = "home.html"; // name of template var $title; // page title; var $numbers = array(); // an array example - + var $form; /* start section - deals with posts, get variables etc.*/ function controller_test() @@ -103,7 +103,10 @@ function start() { - $this->title = "<Hello World>"; + $this->title = "Hello World"; + + $this->form = new StdClass; + $this->form->input = "Hello"; for ($i = 1;$i< 5;$i++) { $this->numbers[$i] = "Number $i"; @@ -143,10 +146,12 @@ <title>{title}</title> </head> <body> + <H1>{title}</H1> + <form name="form"> <table> <tr> <td> - some numbers + Input Box: <input name="input"> </td> </tr> <tr foreach="numbers,number,string"> @@ -168,8 +173,10 @@ <title>Output of example for <classname>HTML_Template_Flexy</classname></title> <programlisting role="php"> <![CDATA[ - -some numbers + +Hello World + +Input Box : [Hello ] Number 1 Number 2 Number 3 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.1 peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.2 --- peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml:1.1 Sat Feb 1 09:16:44 2003 +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/variable.xml Sun Feb 2 04:58:16 2003 @@ -1,5 +1,5 @@ -<!-- $Revision: 1.1 $ --> -<refentry id="package.html.html-template.tag.variable"> +<!-- $Revision: 1.2 $ --> +<refentry id="package.html.html-template-flexy.tag.variable"> <refnamediv> <refname>{variable}</refname> <refpurpose>creates a PHP echo variable</refpurpose> Index: peardoc/peardoc2/en/package/html/html-template-flexy/attribute/select.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/attribute/select.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.attribute.select"> <refnamediv> <refname><SELECT NAME="name"></refname> <refpurpose>creates PHP variable and code for select lists</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter><SELECT NAME="name"></parameter></paramdef> <paramdef><parameter><SELECT NAME="name" static="TRUE"></parameter></paramdef> <paramdef><parameter><SELECT NAME="name" flexyignore="TRUE"></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.attribute.select.desc"> &title.desc; <para> fills in the select values based on the form name and the tag name. If flexyignore is used, it is left alone. If static is set, the currently defined options will be used. And code added to check if the object variable matches them. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.php"> &title.example; <example> <title>Setting variables for input</title> <programlisting role="html"> <![CDATA[ // data object 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); ........ ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.html"> &title.example; <example> <title>Foreach in template</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> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![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> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.attribute.select.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ ** well since I cant show forms, It will look something like this.. [One v] [dogs v] ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/else.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.else"> <refnamediv> <refname>{else:}</refname> <refpurpose>adds an PHP else in an if block</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{else:}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.else.desc"> &title.desc; <para> adds a else statement in PHP so that blocks of conditional HTML are shown correctly. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.php"> &title.example; <example> <title>Setting variables for if</title> <programlisting role="html"> <![CDATA[ class example { function output() { $this->showStuff = faluse; ......... $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.html"> &title.example; <example> <title>Else in template</title> <programlisting role="html"> <![CDATA[ {if:showStuff}Hello{else:}World{end:} ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ <?php if ($t->showStuff) { ?>Hello<?php } else { ?>World<<?php } ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.else.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ World ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/end.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.end"> <refnamediv> <refname>{end:}</refname> <refpurpose>closes an if or foreach block</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{end:}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.end.desc"> &title.desc; <para> adds a closing brace in PHP so that blocks of conditional HTML are shown correctly. You do not need to use {end:} tags if you are using HTML tag attributes like IF="a,b", as the closing HTML tag will indicate that. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.php"> &title.example; <example> <title>Setting variables for if</title> <programlisting role="html"> <![CDATA[ class example { function showDog() { return true; } function output() { $this->showStuff = true; ......... $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.html"> &title.example; <example> <title>Foreach in template</title> <programlisting role="html"> <![CDATA[ {if:showStuff}Hello{end:} {if:showDog()}Doggy{end:} ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ <?php if ($t->showStuff) { ?>Hello<?php } ?> <?php if ($t->showDog()) { ?>Doggy<?php } ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.end.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ Hello Doggy ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/if.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.if"> <refnamediv> <refname>{if:variable}</refname> <refpurpose>creates a PHP if statement</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{if:variable}</parameter></paramdef> <paramdef><parameter>{if:method()}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.if.desc"> &title.desc; <para> creates a if statement, with the argument as a variable or method. You must close and if statement with and {end:} statement, and you may use {else:} with it. </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.php"> &title.example; <example> <title>Setting variables for if</title> <programlisting role="html"> <![CDATA[ class example { function showDog() { return true; } function output() { $this->showStuff = true; ......... $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.html"> &title.example; <example> <title>Foreach in template</title> <programlisting role="html"> <![CDATA[ {if:showStuff}Hello{end:} {if:showDog()}Doggy{end:} ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ <?php if ($t->showStuff) { ?>Hello<?php } ?> <?php if ($t->showDog()) { ?>Doggy<?php } ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.if.example.output"> &title.example; <example> <title>Simple ouput example</title> <programlisting role="html"> <![CDATA[ Hello Doggy ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 --> Index: peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml +++ peardoc/peardoc2/en/package/html/html-template-flexy/tag/method.xml <!-- $Revision: 1.1 $ --> <refentry id="package.html.html-template-flexy.tag.method"> <refnamediv> <refname>{method(arguments,#quoted arguments#)}</refname> <refpurpose>creates a PHP method call, and echos the results</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef> <function>Usage</function></funcdef> <paramdef><parameter>{method()}</parameter></paramdef> <paramdef><parameter>{method():h}</parameter></paramdef> <paramdef><parameter>{method():u}</parameter></paramdef> <paramdef><parameter>{object.method()}</parameter></paramdef> <paramdef><parameter>{method(with.a.variable)}</parameter></paramdef> <paramdef><parameter>{method(with.multiple,variables)}</parameter></paramdef> <paramdef><parameter>{method(with.variables,#and strings or literals#)}</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.html.html-template-flexy.tag.method.desc"> &title.desc; <para> creates an PHP method call, any with any number of arguments, as variables or literals (quoted in #). the return value is echoed, and passed by a modifier (like variables) </para> <para> <itemizedlist> <listitem><simpara>No Modifier - does htmlspecialchars($variable)</simpara></listitem> <listitem><simpara>:h - echos without any change - eg. raw</simpara></listitem> <listitem><simpara>:u - echos urlencode($variable)</simpara></listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.php"> &title.example; <example> <title>Including another template</title> <programlisting role="html"> <![CDATA[ class example_page { var $masterTemplate = "master.html"; var $bodyTemplate = "body.html"; function includeBody() { $template = new HTML_Template_Flexy(); $template->compile($this->bodyTemplate); $template->outputObject($this); } } ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.html"> &title.example; <example> <title>Calling includeBody in template</title> <programlisting role="html"> <![CDATA[ Header Goes Here. {includeBody()} Footer Goes Here. ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.compiled"> &title.example; <example> <title>Compiled template</title> <programlisting role="html"> <![CDATA[ Header Goes Here. <?php echo htmlspecialchars($t->includeBody()); ?> Footer Goes Here. ]]> </programlisting> </example> </refsect1> <refsect1 id="package.html.html-template-flexy.tag.method.example.output"> &title.example; <example> <title>Simple output example</title> <programlisting role="html"> <![CDATA[ Header Goes Here. Hello World Footer Goes Here. ]]> </programlisting> </example> </refsect1> </refentry> <!-- 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 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 -->