纯PHP模板函数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了纯PHP模板函数相关的知识,希望对你有一定的参考价值。
<?php if($include_globals){ } require($file); return $template_html; } $template_vars['title'] = 'Hello World!'; $template_vars['text'] = 'Hello World!'; 'http://www.bigsmoke.us/php-templates/functions', 'http://www.php.net/' ); $html = apply_template("_main.tpl.php",$template_vars); echo $html; /////////////////// // _main.tpl.php // /////////////////// /* <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $title; ?></title> <link rel="shortcut icon" type="image/png" href="favicon.png" /> <link rel="stylesheet" href="./css/reset.css" type="text/css" media="all" /> <link rel="stylesheet" href="./css/text.css" type="text/css" media="all" /> <link rel="stylesheet" href="./css/style.css" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> <!--[if IE]> <link rel="stylesheet" href="./css/ie.css" type="text/css" media="screen, projection" /> <![endif]--> <link rel="script" href="./scripts/javascript.js" type="text/javascript" /> </head> <body> <p><?php echo $text; ?></p> <ul> <?php foreach($links as $link): ?> <li><a href="<?php echo $link; ?>" title="A Link"><?php echo $link; ?></li> <?php endforeach; ?> </ul> </body> </html> */ ?>
以上是关于纯PHP模板函数的主要内容,如果未能解决你的问题,请参考以下文章