PHP Http_template_it class library for template replacement _php template

Source: Internet
Author: User
Two simple templates:
Copy Code code as follows:

<title>{title}</title>
<body>
<font color=red size=6><center>{title}</center></font>
<pre>{body}</pre>
</body>

Copy Code code as follows:

<title>{title}</title>
<body>
<font Color=green size=7><center>{title}</center></font>
<pre>{body}</pre>
</body>

Http_template_it class library must be installed first
Copy Code code as follows:

<?php
Require_once "html/template/it.php";
Creates a new Html_template_it object, where the parameter is the path of the template file
$template = new Html_template_it (' templates/');
Read the template file and get template information by reading the parameters on the address bar
$template->loadtemplatefile ($_get[' template '). " HTM ");
Setting parameters in a stencil
$template->setvariable (' title ', ' Html_template_it ');
$template->setvariable (' body ', ' Hello World ');
Show Page
$template->show ();
?>

You can find the template replacement effect by writing to the browser as follows:
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.