cvs: pear /HTML_Template_Xipe/docs README style.css /HTML_Template_Xipe/docs/simple index.php index.tpl /HTML_Template_Xipe/docs/simple/tmp
.htaccess /HTML_Template_Xipe/docs/xmlConfig config.xml index.php index.tpl /HTML_Template_Xipe/docs/xmlConfig/tmp .htaccess
| From: | Wolfram Kriesing | Date: | Mon, 10 Feb 2003 22:20:00 +0000 |
| Subject: | cvs: pear /HTML_Template_Xipe/docs README style.css /HTML_Template_Xipe/docs/simple index.php index.tpl /HTML_Template_Xipe/docs/simple/tmp .htaccess /HTML_Template_Xipe/docs/xmlConfig config.xml index.php index.tpl /HTML_Template_Xipe/docs/xmlConfig/tmp .htaccess |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8807@lists.php.net to get a copy of this message | ||
cain Mon Feb 10 17:20:00 2003 EDT
Added files:
/pear/HTML_Template_Xipe/docs README style.css
/pear/HTML_Template_Xipe/docs/xmlConfig config.xml index.php
index.tpl
/pear/HTML_Template_Xipe/docs/xmlConfig/tmp .htaccess
/pear/HTML_Template_Xipe/docs/simple index.php index.tpl
/pear/HTML_Template_Xipe/docs/simple/tmp .htaccess
Log:
- moved here
Index: pear/HTML_Template_Xipe/docs/style.css +++ pear/HTML_Template_Xipe/docs/style.css body, td, th { font-size:12px; font-family : Arial; } BODY { /* scrollbar-face-color: #FFFFCE; scrollbar-shadow-color: #FFFFCE; scrollbar-arrow-color: #AFAF8E; scrollbar-track-color: #FFFFCE; scrollbar-darkshadow-color: black */ } table { background-color: #F5F5F5; margin: 0px 0px 0px 0px; padding: 0px; border:0px; } td { background-color: #e1e4eb; padding: 7px; } a { color:#3B4FAE; text-decoration:none; } a:hover { color:white; background-color:#3B4FAE; text-decoration:none; } /** * * HEADLINE * */ a.headlineNaviLinks { color : black; text-decoration : none; background-color: none; } table.headlineBg { height:22px; background-image:url({$page->getLayoutPath(true)}/images/headlineBg.gif); } td.headlineNaviItem, td.naviItem, td.naviItemSelected { font-size : 10px; width:122px; height:12px; background-repeat:no-repeat; background-image:url({$page->getLayoutPath(true)}/images/headlineNaviItemBg.gif) } /** * * NAVIGATION * */ td.naviItem, td.naviItemSelected { width:82px; color:white; background-image:url({$page->getLayoutPath(true)}/images/naviItemBg.gif); } td.naviItemSelected { background-image:url({$page->getLayoutPath(true)}/images/naviCurrentItemBg.gif); } td.currentNaviItem { background-color: #98A0C5; } td.underNaviItems { background-color: #d0d0d0; } a.naviLinks { text-transform:capitalize; color : white; text-decoration : none; background-color: none; } a.naviLinks:hover { color:#d0d0d0; } /** * * (BOOKMARK) LIST * */ td.listTitle, td.listButton { text-transform:capitalize; text-align:center; background-color: #d6d6d6; padding: 2px; } td.listButton { text-align:left; /* none would be better, then every button can be aligned as needed */ } td.listContentLink { background-color: #98A0C5; } a.contentLink { color:white; } a.contentLink:hover { color:#3B4FAE; } /** * * FOLDER TREE * */ a.treeViewParent { color:white; } a.treeView { color:#b5b5b5; padding:1px; } a.currentTreeNode { color:white; } td.treeView { background-color: #494949; color:#b5b5b5; } td.treeNode { background-color: #e1e1e1; } /* a { color : black; text-decoration : none; } */ /** * * this class is used if a link decoration without anything is desired * like for the images in the save dialog * */ a.simple { text-decoration : none; background-color : transparent; } a.simple:HOVER { text-decoration : none; background-color : transparent; } highlight{ color : Maroon; font-style : inherit; font-weight : bold; } th { font-size : 14px; font-weight : normal; font-style : italic; } curFolder { text-decoration : underline; background-color : White; color : Maroon; font-weight : bold; } font { background-color: #e1e4eb; color:#3b4fae; font-size : 14px; font-weight : bold; } warning { background-color: yellow; color:red; font-size : 16px; font-weight : bold; } message { background-color: #e1e4eb; color:#3b4fae; font-size : 16px; font-weight : bold; padding:7px; } code, .code { font-style: Courier; background-color: #EEEEFE; color: #AC1D2E; } Index: pear/HTML_Template_Xipe/docs/xmlConfig/config.xml +++ pear/HTML_Template_Xipe/docs/xmlConfig/config.xml <?xml version="1.0" ?> <HTML_Template_Xipe> <options override="yes"> <delimiter begin="[" end="]"/> <autoBraces value="true"/> <locale value="en"/> <cache> <time value="10" unit="minutes"/> </cache> </options> <!-- !!!!!!! from here this section is not implemented yet only planned !!!!!!! --> <!-- preFilter - register any pre filter here override - ???? registerOnlyOnce - yes or no, this takes care of not registering one filter multiple times it's just not to loose performance inheritOptions - this inherits the options from the SimpleTemplate object automatically --> <preFilter override="no" registerOnlyOnce="yes" inheritOptions="yes"> <register function="removeHtmlComments" object="tplFilter" /> <register function="removeCStyleComments" object="tplFilter" /> <register function="addIfBeforeForeach" object="tplFilter"> <options inherit="SimpleTemplate ????"> <option beginDelimiter="{" endDelimiter="}" /> </options> </register> <!-- unregister - this prevents from calling the filter given in function, no matter from which object/class --> <unregister function="xxx" /> </preFilter> </HTML_Template_Xipe> Index: pear/HTML_Template_Xipe/docs/xmlConfig/index.php +++ pear/HTML_Template_Xipe/docs/xmlConfig/index.php <?php // // $Id: index.php,v 1.1 2003/02/10 22:19:59 cain Exp $ // ini_set('include_path',realpath(dirname(__FILE__).'/../../../../../').':'.realpath(dirname(__FILE__).'/../../../../../../includes').':'.ini_get('include_path')); ini_set('error_reporting',E_ALL); // // include the files needed // require_once('HTML/Template/Xipe.php'); require_once('HTML/Template/Xipe/Filter/Basic.php'); // // make template class instance // $options = array( 'templateDir' => dirname(__FILE__), 'enable-XMLConfig'=>true, 'logLevel' => 1 ); $tpl = new HTML_Template_Xipe($options); //$tpl->setOption('forceCompile',true); // // make filter class instance // /* $tplFilter = new HTML_Template_Xipe_Filter_Basic($tpl->getOptions()); // pre filter $tpl->registerPrefilter(array(&$tplFilter,'removeHtmlComments')); $tpl->registerPrefilter(array(&$tplFilter,'removeCStyleComments')); $tpl->registerPrefilter(array(&$tplFilter,'addIfBeforeForeach')); // this filter makes the foreach-blocks conditional, so they are only shown if they contain data, see api-doc */ // post filter // $tpl->registerPostfilter('trimLines',$tplFilter); // $tpl->registerPostfilter('optimizeHtmlCode',$tplFilter); // // fill variables used in the template // no assign-method necessary // $advantages = array( 'clean HTML-code', 'ALL the power of PHP inside a template', 'a compiled template', 'easy to use (template) engine'); $dontLike = array( 'php-tags in your html', 'the braces: "{" and "}", since they could be replaced by proper indention', 'to learn a new template language'); $url = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/xmlConfig/'; $viewSourceCodeUrl = $url.'index.php'; $viewTemplateCodeUrl = $url.'index.tpl'; $viewCompiledTemplate = $url.'tmp/index.tpl.en.php'; $viewTemplateLog = $url.'tmp/index.tpl.log'; $viewConfigXmlUrl = $url.'config.xml'; // // show the template // $tpl->compile('index.tpl'); include($tpl->getCompiledTemplate()); ?> Index: pear/HTML_Template_Xipe/docs/xmlConfig/index.tpl +++ pear/HTML_Template_Xipe/docs/xmlConfig/index.tpl <!-- $Log: index.tpl,v $ Revision 1.1 2003/02/10 22:19:59 cain - moved here Revision 1.5 2003/01/14 22:08:19 cain - properly convert to Xipe Revision 1.4 2002/06/02 22:38:56 mccain - convert all config-tags to lower case, this is secure for now also if the Tree-package is not updated Revision 1.3 2002/05/26 17:12:19 mccain - added log --> <HTML_Template_Xipe> <options override="yes"> <delimiter begin="[" end="]"/> <autoBraces value="true"/> <locale value="en"/> </options> </HTML_Template_Xipe> <html> <head> <title>Example - HTML_Template_Xipe, XML-configured</title> <link href="../style.css" type="text/css" rel="StyleSheet"> </head> <body> <h2>XML-configured template</h2> <a href="http://sourceforge.net/projects/simpletpl/">DOWNLOAD</a><br> This example uses both possible ways to configure this template, it first reads the <a href="[$viewConfigXmlUrl]">config.xml which is in the same directory as the template</a> and it reads the xml-data which are inside <a href="[$viewTemplateCodeUrl]">this template file</a>, surely this doenst make much sense in this example, but it demonstrates how the config might be applied.<br> You can put the config.xml file anywhere in the 'templateDir' if it is found on the path to the template it will be applied. <br><br> This is the XML-part which configures this template, either in the <a href="[$viewConfigXmlUrl]">config.xml</a> or/and in this <a href="[$viewTemplateCodeUrl]">template-file (index.tpl)</a>.<br> <code> <HTML_Template_Xipe><br> <options override="yes"><br> <delimiter begin="\[" end="\]"/><br> <autoBraces value="true"/><br> <locale value="en"/><br> </options><br> </HTML_Template_Xipe><br> </code> <br><br> <script type="text/javascript" language="JavaScript"> /** * the alert text if you click "really" * @var string s */ var s ="May be _one_disadvantage_ is that you need to escape \n"+ "'{' for getting a '{'\n"+ "and\n"+ "'}' for getting a '}'\n"+ "if those characters are your delimiters\n\n"+ "i didnt mind it yet...\n"; /** * show an alert text as given in 's' * @version 01/12/10 */ function really() { alert(s); } </script> <table border="1"> <tr> <td valign="top"> If you like : [foreach($advantages as $aAdvantage)] <li> [$aAdvantage] </li> </td> <td valign="top"> And you D O N ' T like : [foreach($dontLike as $aDontLike)] <li> [$aDontLike] </li> </td> </tr> </table> then you should try HTML_Template_Xipe.<br><br> <br><br> [foreach($disadvantages as $aDisadvantage)] <li>[$aDisadvantage]</li> [else] no disadvantages registered yet (<a href="javascript:really()">really?</a>) , but feel free and mail <a href="mailto:wolfram@kriesing.de">me</a><br> <a href="[$viewSourceCodeUrl]">but look at the code first</a><br> <a href="[$viewTemplateCodeUrl]">and the template</a><br> <a href="[$viewCompiledTemplate]">and the complied template</a><br> <a href="[$viewTemplateLog]">template log file</a><br> <br><br> <h2>all the currently possible and working xml-options - overview</h2> <code> <HTML_Template_Xipe><br> <options><br> <delimiter begin="\[" end="\]"/><br> <autoBraces value="true"/><br> <locale value="en"/><br> <cache><br> <time value="x" unit="week|weeks|day|days|hour|hours|minute|minutes|second"/><br> <depends value="$someVar $anotherVar $_nextVar"/><br> </cache><br> </options><br> </HTML_Template_Xipe><br> </code> </body> </html> Index: pear/HTML_Template_Xipe/docs/xmlConfig/tmp/.htaccess +++ pear/HTML_Template_Xipe/docs/xmlConfig/tmp/.htaccess Options -Indexes Index: pear/HTML_Template_Xipe/docs/simple/index.php +++ pear/HTML_Template_Xipe/docs/simple/index.php <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Wolfram Kriesing <wolfram@kriesing.de> | // +----------------------------------------------------------------------+ // $Id: index.php,v 1.1 2003/02/10 22:20:00 cain Exp $ ini_set('include_path',realpath(dirname(__FILE__).'/../../../../../').':'.realpath(dirname(__FILE__).'/../../../../../../includes').':'.ini_get('include_path')); ini_set('error_reporting',E_ALL); // // include the files needed // require_once('HTML/Template/Xipe.php'); require_once('HTML/Template/Xipe/Filter/Basic.php'); // // make template class instance // $options = array( 'templateDir' => dirname(__FILE__), 'compileDir' => 'tmp', // use the compile dir 'tmp' under the tempalte dir // or use the following line to specifiy a complete path //'compileDir' => $DOCUMENT_ROOT.'/libs/php/SimpleTemplate/examples/simple/tmp', 'verbose' => true, // this is default too 'locale' => '', // there is no language stuff here 'logLevel' => 1, // write log-file // let me define the filters i want to use 'filterLevel' => 0 // level 0 means no filter by default ); $tpl = new HTML_Template_Xipe($options); // // make filter class instance // and apply filters as needed // $tplFilter = new HTML_Template_Xipe_Filter_Basic($tpl->getOptions()); // pre filter $tpl->registerPrefilter(array(&$tplFilter,'removeHtmlComments')); $tpl->registerPrefilter(array(&$tplFilter,'removeCStyleComments')); $tpl->registerPrefilter(array(&$tplFilter,'addIfBeforeForeach')); // this filter makes the foreach-blocks conditional, so they are only shown if they contain data, see api-doc // post filter $tpl->registerPostfilter(array(&$tplFilter,'trimLines')); $tpl->registerPostfilter(array(&$tplFilter,'optimizeHtmlCode')); // // fill variables used in the template // no assign-method necessary // $advantages = array( 'clean HTML-code', 'ALL the power of PHP inside a template', 'a compiled template', 'easy to use (template) engine'); $dontLike = array( 'php-tags in your html', 'the braces: "{" and "}", since they could be replaced by proper indention', 'to learn a new template language'); $viewSourceCodeUrl = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/index.php'; $viewTemplateCodeUrl = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/index.tpl'; $viewClassCodeUrl = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/Engine.php'; $viewCompiledTemplate = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/tmp/index.tpl.en.php'; $viewTemplateLog = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/tmp/index.tpl.log'; // // show the template // $tpl->compile('index.tpl'); include($tpl->getCompiledTemplate()); ?> Index: pear/HTML_Template_Xipe/docs/simple/index.tpl +++ pear/HTML_Template_Xipe/docs/simple/index.tpl <!--// // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Wolfram Kriesing <wolfram@kriesing.de> | // +----------------------------------------------------------------------+ // $Id: index.tpl,v 1.1 2003/02/10 22:20:00 cain Exp $ //--> <html> <head> <title>Example - HTML_Template_Xipe</title> <link href="../style.css" type="text/css" rel="StyleSheet"> </head> <body> <script type="text/javascript" language="JavaScript"> /** * the alert text if you click "really" * @var string s */ var s ="May be _one_disadvantage_ is that you need to escape \n"+ "'\\\{' for getting a '\{'\n"+ "and\n"+ "'\\\}' for getting a '\}'\n"+ "if those characters are your delimiters\n\n"+ "i didnt mind it yet...\n"; /** * show an alert text as given in 's' * @version 01/12/10 */ function really() \{ alert(s); \} </script> <table border="1"> <tr> <td valign="top"> If you like : {foreach($advantages as $aAdvantage)} <li>{$aAdvantage}</li> </td> <td valign="top"> And you D O N ' T like : {foreach($dontLike as $aDontLike)} <li>{$aDontLike}</li> </td> </tr> </table> then you should try HTML_Template_Xipe.<br><br> <br><br> {foreach($disadvantages as $aDisadvantage)} <li>{$aDisadvantage}</li> {else} no disadvantages registered yet (<a href="javascript:really()">really?</a>) , but feel free and mail <a href="mailto:wolfram@kriesing.de">me</a><br> <a href="{$viewSourceCodeUrl}">but look at the code first</a><br> <a href="{$viewTemplateCodeUrl}">and the template</a><br> <a href="{$viewCompiledTemplate}">and the complied template</a><br> <a href="{$viewTemplateLog}">template log file</a><br> <br><br> </body> </html> Index: pear/HTML_Template_Xipe/docs/simple/tmp/.htaccess +++ pear/HTML_Template_Xipe/docs/simple/tmp/.htaccess Options -Indexes
Index: pear/HTML_Template_Xipe/docs/style.css +++ pear/HTML_Template_Xipe/docs/style.css body, td, th { font-size:12px; font-family : Arial; } BODY { /* scrollbar-face-color: #FFFFCE; scrollbar-shadow-color: #FFFFCE; scrollbar-arrow-color: #AFAF8E; scrollbar-track-color: #FFFFCE; scrollbar-darkshadow-color: black */ } table { background-color: #F5F5F5; margin: 0px 0px 0px 0px; padding: 0px; border:0px; } td { background-color: #e1e4eb; padding: 7px; } a { color:#3B4FAE; text-decoration:none; } a:hover { color:white; background-color:#3B4FAE; text-decoration:none; } /** * * HEADLINE * */ a.headlineNaviLinks { color : black; text-decoration : none; background-color: none; } table.headlineBg { height:22px; background-image:url({$page->getLayoutPath(true)}/images/headlineBg.gif); } td.headlineNaviItem, td.naviItem, td.naviItemSelected { font-size : 10px; width:122px; height:12px; background-repeat:no-repeat; background-image:url({$page->getLayoutPath(true)}/images/headlineNaviItemBg.gif) } /** * * NAVIGATION * */ td.naviItem, td.naviItemSelected { width:82px; color:white; background-image:url({$page->getLayoutPath(true)}/images/naviItemBg.gif); } td.naviItemSelected { background-image:url({$page->getLayoutPath(true)}/images/naviCurrentItemBg.gif); } td.currentNaviItem { background-color: #98A0C5; } td.underNaviItems { background-color: #d0d0d0; } a.naviLinks { text-transform:capitalize; color : white; text-decoration : none; background-color: none; } a.naviLinks:hover { color:#d0d0d0; } /** * * (BOOKMARK) LIST * */ td.listTitle, td.listButton { text-transform:capitalize; text-align:center; background-color: #d6d6d6; padding: 2px; } td.listButton { text-align:left; /* none would be better, then every button can be aligned as needed */ } td.listContentLink { background-color: #98A0C5; } a.contentLink { color:white; } a.contentLink:hover { color:#3B4FAE; } /** * * FOLDER TREE * */ a.treeViewParent { color:white; } a.treeView { color:#b5b5b5; padding:1px; } a.currentTreeNode { color:white; } td.treeView { background-color: #494949; color:#b5b5b5; } td.treeNode { background-color: #e1e1e1; } /* a { color : black; text-decoration : none; } */ /** * * this class is used if a link decoration without anything is desired * like for the images in the save dialog * */ a.simple { text-decoration : none; background-color : transparent; } a.simple:HOVER { text-decoration : none; background-color : transparent; } highlight{ color : Maroon; font-style : inherit; font-weight : bold; } th { font-size : 14px; font-weight : normal; font-style : italic; } curFolder { text-decoration : underline; background-color : White; color : Maroon; font-weight : bold; } font { background-color: #e1e4eb; color:#3b4fae; font-size : 14px; font-weight : bold; } warning { background-color: yellow; color:red; font-size : 16px; font-weight : bold; } message { background-color: #e1e4eb; color:#3b4fae; font-size : 16px; font-weight : bold; padding:7px; } code, .code { font-style: Courier; background-color: #EEEEFE; color: #AC1D2E; } Index: pear/HTML_Template_Xipe/docs/xmlConfig/config.xml +++ pear/HTML_Template_Xipe/docs/xmlConfig/config.xml <?xml version="1.0" ?> <HTML_Template_Xipe> <options override="yes"> <delimiter begin="[" end="]"/> <autoBraces value="true"/> <locale value="en"/> <cache> <time value="10" unit="minutes"/> </cache> </options> <!-- !!!!!!! from here this section is not implemented yet only planned !!!!!!! --> <!-- preFilter - register any pre filter here override - ???? registerOnlyOnce - yes or no, this takes care of not registering one filter multiple times it's just not to loose performance inheritOptions - this inherits the options from the SimpleTemplate object automatically --> <preFilter override="no" registerOnlyOnce="yes" inheritOptions="yes"> <register function="removeHtmlComments" object="tplFilter" /> <register function="removeCStyleComments" object="tplFilter" /> <register function="addIfBeforeForeach" object="tplFilter"> <options inherit="SimpleTemplate ????"> <option beginDelimiter="{" endDelimiter="}" /> </options> </register> <!-- unregister - this prevents from calling the filter given in function, no matter from which object/class --> <unregister function="xxx" /> </preFilter> </HTML_Template_Xipe> Index: pear/HTML_Template_Xipe/docs/xmlConfig/index.php +++ pear/HTML_Template_Xipe/docs/xmlConfig/index.php <?php // // $Id: index.php,v 1.1 2003/02/10 22:19:59 cain Exp $ // ini_set('include_path',realpath(dirname(__FILE__).'/../../../../../').':'.realpath(dirname(__FILE__).'/../../../../../../includes').':'.ini_get('include_path')); ini_set('error_reporting',E_ALL); // // include the files needed // require_once('HTML/Template/Xipe.php'); require_once('HTML/Template/Xipe/Filter/Basic.php'); // // make template class instance // $options = array( 'templateDir' => dirname(__FILE__), 'enable-XMLConfig'=>true, 'logLevel' => 1 ); $tpl = new HTML_Template_Xipe($options); //$tpl->setOption('forceCompile',true); // // make filter class instance // /* $tplFilter = new HTML_Template_Xipe_Filter_Basic($tpl->getOptions()); // pre filter $tpl->registerPrefilter(array(&$tplFilter,'removeHtmlComments')); $tpl->registerPrefilter(array(&$tplFilter,'removeCStyleComments')); $tpl->registerPrefilter(array(&$tplFilter,'addIfBeforeForeach')); // this filter makes the foreach-blocks conditional, so they are only shown if they contain data, see api-doc */ // post filter // $tpl->registerPostfilter('trimLines',$tplFilter); // $tpl->registerPostfilter('optimizeHtmlCode',$tplFilter); // // fill variables used in the template // no assign-method necessary // $advantages = array( 'clean HTML-code', 'ALL the power of PHP inside a template', 'a compiled template', 'easy to use (template) engine'); $dontLike = array( 'php-tags in your html', 'the braces: "{" and "}", since they could be replaced by proper indention', 'to learn a new template language'); $url = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/xmlConfig/'; $viewSourceCodeUrl = $url.'index.php'; $viewTemplateCodeUrl = $url.'index.tpl'; $viewCompiledTemplate = $url.'tmp/index.tpl.en.php'; $viewTemplateLog = $url.'tmp/index.tpl.log'; $viewConfigXmlUrl = $url.'config.xml'; // // show the template // $tpl->compile('index.tpl'); include($tpl->getCompiledTemplate()); ?> Index: pear/HTML_Template_Xipe/docs/xmlConfig/index.tpl +++ pear/HTML_Template_Xipe/docs/xmlConfig/index.tpl <!-- $Log: index.tpl,v $ Revision 1.1 2003/02/10 22:19:59 cain - moved here Revision 1.5 2003/01/14 22:08:19 cain - properly convert to Xipe Revision 1.4 2002/06/02 22:38:56 mccain - convert all config-tags to lower case, this is secure for now also if the Tree-package is not updated Revision 1.3 2002/05/26 17:12:19 mccain - added log --> <HTML_Template_Xipe> <options override="yes"> <delimiter begin="[" end="]"/> <autoBraces value="true"/> <locale value="en"/> </options> </HTML_Template_Xipe> <html> <head> <title>Example - HTML_Template_Xipe, XML-configured</title> <link href="../style.css" type="text/css" rel="StyleSheet"> </head> <body> <h2>XML-configured template</h2> <a href="http://sourceforge.net/projects/simpletpl/">DOWNLOAD</a><br> This example uses both possible ways to configure this template, it first reads the <a href="[$viewConfigXmlUrl]">config.xml which is in the same directory as the template</a> and it reads the xml-data which are inside <a href="[$viewTemplateCodeUrl]">this template file</a>, surely this doenst make much sense in this example, but it demonstrates how the config might be applied.<br> You can put the config.xml file anywhere in the 'templateDir' if it is found on the path to the template it will be applied. <br><br> This is the XML-part which configures this template, either in the <a href="[$viewConfigXmlUrl]">config.xml</a> or/and in this <a href="[$viewTemplateCodeUrl]">template-file (index.tpl)</a>.<br> <code> <HTML_Template_Xipe><br> <options override="yes"><br> <delimiter begin="\[" end="\]"/><br> <autoBraces value="true"/><br> <locale value="en"/><br> </options><br> </HTML_Template_Xipe><br> </code> <br><br> <script type="text/javascript" language="JavaScript"> /** * the alert text if you click "really" * @var string s */ var s ="May be _one_disadvantage_ is that you need to escape \n"+ "'{' for getting a '{'\n"+ "and\n"+ "'}' for getting a '}'\n"+ "if those characters are your delimiters\n\n"+ "i didnt mind it yet...\n"; /** * show an alert text as given in 's' * @version 01/12/10 */ function really() { alert(s); } </script> <table border="1"> <tr> <td valign="top"> If you like : [foreach($advantages as $aAdvantage)] <li> [$aAdvantage] </li> </td> <td valign="top"> And you D O N ' T like : [foreach($dontLike as $aDontLike)] <li> [$aDontLike] </li> </td> </tr> </table> then you should try HTML_Template_Xipe.<br><br> <br><br> [foreach($disadvantages as $aDisadvantage)] <li>[$aDisadvantage]</li> [else] no disadvantages registered yet (<a href="javascript:really()">really?</a>) , but feel free and mail <a href="mailto:wolfram@kriesing.de">me</a><br> <a href="[$viewSourceCodeUrl]">but look at the code first</a><br> <a href="[$viewTemplateCodeUrl]">and the template</a><br> <a href="[$viewCompiledTemplate]">and the complied template</a><br> <a href="[$viewTemplateLog]">template log file</a><br> <br><br> <h2>all the currently possible and working xml-options - overview</h2> <code> <HTML_Template_Xipe><br> <options><br> <delimiter begin="\[" end="\]"/><br> <autoBraces value="true"/><br> <locale value="en"/><br> <cache><br> <time value="x" unit="week|weeks|day|days|hour|hours|minute|minutes|second"/><br> <depends value="$someVar $anotherVar $_nextVar"/><br> </cache><br> </options><br> </HTML_Template_Xipe><br> </code> </body> </html> Index: pear/HTML_Template_Xipe/docs/xmlConfig/tmp/.htaccess +++ pear/HTML_Template_Xipe/docs/xmlConfig/tmp/.htaccess Options -Indexes Index: pear/HTML_Template_Xipe/docs/simple/index.php +++ pear/HTML_Template_Xipe/docs/simple/index.php <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Wolfram Kriesing <wolfram@kriesing.de> | // +----------------------------------------------------------------------+ // $Id: index.php,v 1.1 2003/02/10 22:20:00 cain Exp $ ini_set('include_path',realpath(dirname(__FILE__).'/../../../../../').':'.realpath(dirname(__FILE__).'/../../../../../../includes').':'.ini_get('include_path')); ini_set('error_reporting',E_ALL); // // include the files needed // require_once('HTML/Template/Xipe.php'); require_once('HTML/Template/Xipe/Filter/Basic.php'); // // make template class instance // $options = array( 'templateDir' => dirname(__FILE__), 'compileDir' => 'tmp', // use the compile dir 'tmp' under the tempalte dir // or use the following line to specifiy a complete path //'compileDir' => $DOCUMENT_ROOT.'/libs/php/SimpleTemplate/examples/simple/tmp', 'verbose' => true, // this is default too 'locale' => '', // there is no language stuff here 'logLevel' => 1, // write log-file // let me define the filters i want to use 'filterLevel' => 0 // level 0 means no filter by default ); $tpl = new HTML_Template_Xipe($options); // // make filter class instance // and apply filters as needed // $tplFilter = new HTML_Template_Xipe_Filter_Basic($tpl->getOptions()); // pre filter $tpl->registerPrefilter(array(&$tplFilter,'removeHtmlComments')); $tpl->registerPrefilter(array(&$tplFilter,'removeCStyleComments')); $tpl->registerPrefilter(array(&$tplFilter,'addIfBeforeForeach')); // this filter makes the foreach-blocks conditional, so they are only shown if they contain data, see api-doc // post filter $tpl->registerPostfilter(array(&$tplFilter,'trimLines')); $tpl->registerPostfilter(array(&$tplFilter,'optimizeHtmlCode')); // // fill variables used in the template // no assign-method necessary // $advantages = array( 'clean HTML-code', 'ALL the power of PHP inside a template', 'a compiled template', 'easy to use (template) engine'); $dontLike = array( 'php-tags in your html', 'the braces: "{" and "}", since they could be replaced by proper indention', 'to learn a new template language'); $viewSourceCodeUrl = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/index.php'; $viewTemplateCodeUrl = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/index.tpl'; $viewClassCodeUrl = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/Engine.php'; $viewCompiledTemplate = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/tmp/index.tpl.en.php'; $viewTemplateLog = 'http://www.kriesing.de/showsource.php?domain=wolfram.kriesing.de&file=/libs/php/SimpleTemplate/examples/simple/tmp/index.tpl.log'; // // show the template // $tpl->compile('index.tpl'); include($tpl->getCompiledTemplate()); ?> Index: pear/HTML_Template_Xipe/docs/simple/index.tpl +++ pear/HTML_Template_Xipe/docs/simple/index.tpl <!--// // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Wolfram Kriesing <wolfram@kriesing.de> | // +----------------------------------------------------------------------+ // $Id: index.tpl,v 1.1 2003/02/10 22:20:00 cain Exp $ //--> <html> <head> <title>Example - HTML_Template_Xipe</title> <link href="../style.css" type="text/css" rel="StyleSheet"> </head> <body> <script type="text/javascript" language="JavaScript"> /** * the alert text if you click "really" * @var string s */ var s ="May be _one_disadvantage_ is that you need to escape \n"+ "'\\\{' for getting a '\{'\n"+ "and\n"+ "'\\\}' for getting a '\}'\n"+ "if those characters are your delimiters\n\n"+ "i didnt mind it yet...\n"; /** * show an alert text as given in 's' * @version 01/12/10 */ function really() \{ alert(s); \} </script> <table border="1"> <tr> <td valign="top"> If you like : {foreach($advantages as $aAdvantage)} <li>{$aAdvantage}</li> </td> <td valign="top"> And you D O N ' T like : {foreach($dontLike as $aDontLike)} <li>{$aDontLike}</li> </td> </tr> </table> then you should try HTML_Template_Xipe.<br><br> <br><br> {foreach($disadvantages as $aDisadvantage)} <li>{$aDisadvantage}</li> {else} no disadvantages registered yet (<a href="javascript:really()">really?</a>) , but feel free and mail <a href="mailto:wolfram@kriesing.de">me</a><br> <a href="{$viewSourceCodeUrl}">but look at the code first</a><br> <a href="{$viewTemplateCodeUrl}">and the template</a><br> <a href="{$viewCompiledTemplate}">and the complied template</a><br> <a href="{$viewTemplateLog}">template log file</a><br> <br><br> </body> </html> Index: pear/HTML_Template_Xipe/docs/simple/tmp/.htaccess +++ pear/HTML_Template_Xipe/docs/simple/tmp/.htaccess Options -Indexes