把smarty压缩包下载下来后解压,把libs文件夹放到自己网站的根目录下(或者也可以把文件夹的名称换掉,比如“根目录/includes/libraries/smarty”)。然后在网站根目录下建立一个templates文件夹,专门用来存放HTML页面模板。
打开templates文件夹,在其中创建以下三个文件夹:
templates_c
config
cache
然后创建一个index.tpl的HTML模板文件,内容如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>My First Smarty Page</title>
</head>
<body>
<header>
<h2>My First Smarty Page </h2>
</header>
<main>
<article>
<section>Content for New main Tag Goes Here</section>
<section>{$hello}</section>
</article>
</main>
</body>
</html>