HTML_Template_Xipe
| From: | Tommy Ipsen | Date: | Sat, 28 Jun 2003 21:10:23 +0000 |
| Subject: | HTML_Template_Xipe | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6301@lists.php.net to get a copy of this message | ||
Hi
I have a problem nesting templates when using HTML_Template_Xipe...
This is the short version of what I have:
index.php:
$options = array(
'templateDir' => 'templates', // root-directory for storing templates
'compileDir' => 'tmp', // directory for compiled templates
//'debug' => 1, // debug level
//'filterLevel' => 9, // :TODO: filters nothing - only during debug-face!
'forceCompile' => true, // :TODO: forces a recompilation of templates - only during debug-face!
//'logLevel' => 0, // :TODO: logs everything - only during debug-face!
//'enable-Cache' => true, // enable caching of templates - remember administrative possibility to recompile!
//'locale' => '', // no translation of templates - therefore locale is not required!
//'verbose' => true, // :TODO: should be false on a production system!
'autoBraces' => false
);
// stuff...
$tpl = new HTML_Template_Xipe($options);
$tpl->compile('index.tpl');
include($tpl->getCompiledTemplate());
index.tpl:
<html>
<body>
// stuff...
{%include content.tpl%}
</body>
</html>
This works fine, meaning content.tpl is also parsed as a template by Xipe. But I would really like to do something like:
{%include $contentfile%}
Where $contentfile contains a filename depending on a parameter given by the user. The above code however is only possible like this:
{include 'templates/filename.tpl';}
Which results in the template not being parsed by xipe and the $variables in filename.tpl appearing "as written" ie. not substituted with the value of the variable!
Therefore my question is how to include (and parse) a file/template when the name of the file/template is stored in a variable!
Thanks in advance!
Tommy Ipsen