把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>