Hi - I am using PEAR IT and it all seems pretty straight forward. However, i am trying to assign a place holder dynamically by using the <!--INCLUDE --> statement, and it doesn't seem to work for me. Basically I am grabbing a page name from $HTTP_GET_VARS[] and then trying to set it to a variable, then in the tpl file trying to dynamically include the page requested (basically the same as an include statement)
$template = new HTML_Template_IT('.');
$template->loadTemplatefile("content.tpl", true, true);
/* Check to see which page has been requested and if the file exists. If not, include error message */
if(!empty($http_GET_VARS[page])&& file_exists("content/$http_GET_VARS[page].tpl"))
{
$page="content/$http_GET_VARS[page].tpl";
}
else
{
$page="content/error.tpl";
}
$template->setCurrentBlock("CONTENT");
$template->setVariable("PAGE", $page);
$template->parseCurrentBlock();
$template->show();
Then in the template (.tpl) file, I assign the 'PAGE" variable to a placeholder like this:
<!-- INCLUDE {PAGE} -->
This doesn't seem to work - however if I hard code the path to the file in the indclude statement (Ie: <!-- INCLUDE content/test.tpl --> it works no problem?
I have also tried assigning the variable to the include string
$template->setVariable("PAGE", "<!-- INCLUDE $page -->"); with no luck.
If anyone has any idea on why this doesn't work - I'd love to hear about or any other way of achieving this.
Cheers