Help ,Question About HTML_Template_Xipe
| From: | wingoffire | Date: | Sat, 10 May 2003 18:56:37 +0000 |
| Subject: | Help ,Question About HTML_Template_Xipe | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5295@lists.php.net to get a copy of this message | ||
I'm a new user of your Xipe,last night I install it and try to run the
demo like below
xipe.tpl
<html>
<title>{$title}</title>
<body>
Welcome {$username}!
You can choose from:
<!--
a simple foreach-loop as you know it from PHP
all the indented lines below the foreach-line
are looped (from the <li> to the </li>)
-->
{foreach( $list as $aItem )}
<li>
{$aItem}
</li>
<br />
Please don't hesitate to choose the right thing :-)
</body>
</html>
xipe.php
<?php
// require the engine which is in the include path
require_once ('HTML/Template/Xipe.php');
// define the options for the template engine
$options = array
(
// the root-directory where to find the templates
'templateDir' => dirname(__FILE__),
// the directory where to store the compiled template
'compileDir' => 'tmp'
);
// create an instance of the template engine
$tpl = new HTML_Template_Xipe($options);
// the template file is in the templateDir, the same directory
// as where the php-file is, therefore we only need to give the file name
$tpl->compile('xipe.tpl');
// this includes the finally compiled template, which is a php-file
$list = array ( 'abc' , 'def' , 'ghi');
include($tpl->getCompiledTemplate());
?>
then I run it but the result is:
# Welcome ! You can choose from:
・ghi
Please don't hesitate to choose the right thing :-)
but not
# Welcome ! You can choose from:
・abc
・def
・ghi
Please don't hesitate to choose the right thing :-)