cvs: peardoc /en/package/html/html-template-flexy intro.xml

From: Date: Thu, 14 Dec 2006 12:17:36 +0000
Subject: cvs: peardoc /en/package/html/html-template-flexy intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-9069@lists.php.net to get a copy of this message
cweiske Thu Dec 14 12:17:36 2006 UTC Modified files: /peardoc/en/package/html/html-template-flexy intro.xml Log: Fixing bug #8113: Example does not work on windows http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-template-flexy/intro.xml?r1=1.12&r2=1.13&diff_format=u Index: peardoc/en/package/html/html-template-flexy/intro.xml diff -u peardoc/en/package/html/html-template-flexy/intro.xml:1.12 peardoc/en/package/html/html-template-flexy/intro.xml:1.13 --- peardoc/en/package/html/html-template-flexy/intro.xml:1.12 Mon Feb 27 21:56:00 2006 +++ peardoc/en/package/html/html-template-flexy/intro.xml Thu Dec 14 12:17:36 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <refentry id="package.html.html-template-flexy.intro"> <refnamediv> <refname>Introduction</refname> @@ -27,31 +27,31 @@ These templates are designed to be editable in WYSIWYG HTML editors, without breaking the tags</simpara> </listitem> - - + + <listitem> <simpara>Regex - A classic templating backend, for supporting Smarty, Xipe, or Email type convertion to PHP code. </simpara> </listitem> - - + + <listitem> <simpara>Raw - A non compiling backend, that enables you to create templates using PHP, Useful if you intend to redistribute your application and are concerned about compilation </simpara> </listitem> - + </itemizedlist> </para> <para> Data can be assigned in two ways with flexy, depending on your prefered style of working. </para> - - + + <para> <itemizedlist> - + <listitem> <simpara>Push - you put data into the template engine, using $flexy-&gt;setData(), and $flexy-&gt;setDataByRef(), this is similar to the way Smarty and other templates @@ -66,15 +66,15 @@ eg. <link linkend="package.php.phpdocumentor">PHPDoc</link> comments. </simpara> </listitem> - + </itemizedlist> </para> <para> With all this Flexibility, it still manages to achieve - - - - + + + + </para> <para> <itemizedlist> @@ -84,10 +84,10 @@ <listitem> <simpara>In Normal operation very little code is actually loaded (so it's fast)</simpara> </listitem> - + </itemizedlist> </para> - + </refsect1> <refsect1> <title>How does HTML_Template_Flexy differ from other template systems</title> @@ -121,15 +121,16 @@ 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> <title>Typical usage example for <classname>HTML_Template_Flexy</classname></title> <programlisting role="php"> <![CDATA[ -<?php - +<?php + /* configure the application - probably done elsewhere */ require_once 'HTML/Template/Flexy.php'; +require_once 'PEAR.php'; $options = &PEAR::getStaticProperty('HTML_Template_Flexy','options'); $config = parse_ini_file('example.ini',TRUE); $options = $config['HTML_Template_Flexy']; @@ -139,14 +140,14 @@ class controller_test { - + var $template = "home.html"; // name of template var $title; // this relates to {title}; var $numbers = array(); // this relates to {numbers} , used with foreach var $anObject; - + var $elements = array(); // this is where the elements are stored - + /* start section - deals with posts, get variables etc.*/ function controller_test() @@ -160,49 +161,48 @@ { // the title $this->title = "Hello World"; - + // store an object. $this->anObject = new StdClass; - + // assign a value to a member. $this->anObject->member = 'Object Member'; - + // if you need form elements - you have to include them. require_once 'HTML/Template/Flexy/Element.php'; - + // create an HTML Element for the form element. $this->elements['input'] = new HTML_Template_Flexy_Element; - + // assign a value to it $this->elements['input']->setValue('Hello'); - - + + for ($i = 1;$i< 5;$i++) { $this->numbers[$i] = "Number $i"; } } - + /* output section - probably best to put this in the default_controller class */ - + function output() { $output = new HTML_Template_Flexy(); $output->compile($this->template); $output->outputObject($this,$this->elements); } - - + + function someMethod() { - return "<B>Hello From A Method</B>"; + return "<b>Hello From A Method</b>"; } - - - + + + } /* the page controller instantaation - probably done with a factory method in your master page controller class */ -new controller_test; - +new controller_test(); ?> ]]> @@ -215,63 +215,63 @@ <title>Example Template for <classname>HTML_Template_Flexy</classname></title> <programlisting role="php"> <![CDATA[ - +//ignore any php tags before this comment <html> <head> <title>{title}</title> </head> <body> <H1>{title}</H1> - - - + + + <form name="form"> <table> <tr> <td> <?php /* this will be merged with the date in the $element['input'] object*/ ?> - + Input Box: <input name="input"> </td> </tr> - + <?php /* note here the use for flexy:foreach as an attribute value */ ?> - + <tr flexy:foreach="numbers,number,string"> <td> - + <?php /* note here the use for flexy:foreach as an attribute value */ ?> - + <a href="mypage.html?id=%7Bnumber%7D">{string}</a> </td> </tr> - - + + </table> - + <?php /* there is some limited support for array access */ ?> - + this is number 2 : {numbers[2]} - - + + <?php /* note that full stops seperate object and variables or methods */ ?> - + This is a {anObject.member} - + <?php /* you can call methods of the object */ ?> - + {someMethod()} - + <?php /* by default everything is htmlspecialchar escaped use the modifier :h to prevent this. */ ?> - + {someMethod():h} - + </body> </html> <?php /* I've used php for comments here as HTML comments didnt work when generating the manual .. - you dont have to use them - it has nothing to do with the template engine */ ?> - + ]]> </programlisting> </example> @@ -292,7 +292,7 @@ Number 2 Number 3 Number 4 - + this is number 2 : Number 2 @@ -306,9 +306,9 @@ </programlisting> </example> </refsect1> - </refentry> - - + </refentry> + + <!-- Keep this comment at the end of the file Local variables:

« previous php.pear.doc (#9069) next »