Hi - I am using PEAR IT and it all seems pretty straight forward. However, i am tryign to assign a place holder dymanically 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)
Then in the template (.tpl) file, I assign the 'PAGE" variable to a placeholder like this:
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?
If anyone has any idea on why this doesn't work - I'd love to hear about .
CHeers
Code:
$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:
Code:
<!-- 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?
If anyone has any idea on why this doesn't work - I'd love to hear about .
CHeers