微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP DOM Template

程序名称:PHP DOM Template

授权协议: 未知

操作系统: 跨平台

开发语言: PHP

PHP DOM Template 介绍

PHP DOM Template 是一个快速PHP 模板引擎,下面是一个 Hello World 的例子:

<?PHP  
// Start the output buffer  
ob_start();  
?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
  <Meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  <title>PHP Dom Template (PDT) Library - example01.html</title>  
  <link rel="stylesheet" type="text/css" href="../css/stylesheet.css" />  
</head>  
<body>  
  <p><a href="../example01.PHP">Back To Example 1</a></p>  
  <div id="content">  
    <h1>Hello World</h1>  
    <p var="helloWorld">Default Text</p>  
    <p>&#160;</p>  
    <p class="copyright"><a href="http://www.domtemplate.com">copyright 2008 PHP DOM Template</a></p>  
  </div>  
  <p><a href="../example01.PHP">Back To Example 1</a></p>  
</body>  
</html>  
<?PHP  
// include the Template lib  
include_once dirname(__FILE__) . '/../Template.PHP';  
// Create a template from the html in the buffer  
$buff = ob_get_clean();  
$template = Dk_Dom_Template::loadXml($buff);  
$template->replaceText('helloWorld', 'This is the `Hello World` Dynamic text.');  
echo $template->getDocument()->saveXML();  
?>

PHP DOM Template 官网

http://www.domtemplate.com/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐