Home > Backend Development > PHP Tutorial > php Http_Template_IT class library for template replacement_PHP tutorial

php Http_Template_IT class library for template replacement_PHP tutorial

WBOY
Release: 2016-07-21 15:46:51
Original
954 people have browsed it

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

www.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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template