Two simple templates:
Copy code The code is as follows:
{title} {title}< /center>
{body}
Copy code The code is as follows:
< title>{title}
{title} {body}
Http_Template_IT class must be installed first Library
Copy code The code is as follows:
require_once "HTML/Template/IT.php" ;
//Create a new HTML_Template_IT object, where the parameter is the path to the template file
$template = new HTML_Template_IT('templates/');
//Read the template file by reading the address bar Parameters to obtain template information
$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 in the browser and you will see 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
http://www.bkjia.com/PHPjc/320061.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320061.htmlTechArticleTwo simple templates: Copy the code as follows: html head title{title}/title /head body font color= red size=6center{title}/center/font hr pre{body}/pre /body /html Copy code code...