I am trying the same code and have a similar situation. I put some php codes in the html template (though I use php extension for the file), but it just didn't work. I got a solution to this problem from another forum, which works to some extent. That is the reason I posted this message to seek furhter help.
What you could do is to write additional functions in your class file, and use those functions to set the variable values. For example, if you need to include a menu bar, you may write in the class:
function menu (){
include 'menu.php';//You may just write the code for the menu here. menu.php can contain php codes.
}
Assuming you have a variable in the template called {MENU}, in the file for displaying the page using the template, you write something like this:
$page = new HtmlTemplate2 ("template.php");
Set $page->SetParameter ("MENU", $page->menu());
My problem is that the menu appears in a wrong place. Say I place {MENU} below an image banner, but it appears above the menu. This happens to all those variables I use functions to set. Some functions do not work at all this way. For example, following function displays nothing for some reasons using the method I just described.
function ads1(){
if (@include(getenv('DOCUMENT_ROOT').'ads.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('', 2, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
}
Please help me out here.