-1

我真的搜索过,但一无所获。

我是模板精简版的新手。我添加了我的项目 template_lite 库,我有两个文件。

test.php 是:

require("../src/class.template.php");
$tpl = new Template_Lite;
$tpl->compile_dir = "compiled/";
$tpl->compile_dir = "templates/";
$tpl->assign("foo","bar");

我有简单的 html 来查看我的代码

<html>
<head>
<title>Document Title</title>
</head>
<body>
{$foo}
</body>
</html>

它打印“{$foo}”而不是为什么:S

4

1 回答 1

0

您似乎错过了对display(). 典型的模板样本需要以下内容

// test.php
require("../src/class.template.php");
$tpl = new Template_Lite;
$tpl->compile_dir = "compiled/";
$tpl->compile_dir = "templates/";
$tpl->assign("foo","bar");

$tpl->display("test.tpl");

和模板templates/test.tpl

<html>
<head>
<title>Document Title</title>
</head>
<body>
{* this is a comment *}
{ $foo }
</body>
</html>

您在浏览器中请求的 URL 将是test.php

于 2012-02-07T00:46:34.173 回答