PhpHttp_Template_IT template replacement implementation code two simple templates:
The code is as follows:
{Title}
{Title}
{body}
The code is as follows:
{Title}
{Title}
{body}
You must first install the Http_Template_IT class library
The code is as follows:
Require_once "HTML/Template/IT. php ";
// Create a new HTML_Template_IT object. the parameter is the path of the template file.
$ Template = new HTML_Template_IT ('Templates /');
// Read the template file and obtain the template information by reading the parameters in the address bar
$ Template-> loadTemplateFile ($ _ GET ['template']. ". htm ");
// Set parameters in the template
$ Template-> setVariable ('title', 'HTML _ Template_IT ');
$ Template-> setVariable ('body', 'Hello World ');
// Display Page
$ Template-> show ();
?>
Write the following information in the browser and you will find the template replacement effect:
Http: // localhost: 8082/file:/F:/php/phpcode/23/23 .4.3/23.4.3.php? Template = T2
Http: // localhost: 8082/file:/F:/php/phpcode/23/23 .4.3/23.4.3.php? Template = T1