下載解壓縮就不用說了
官方網站:http://smarty.php.net
php.net也有相關資料:http://news.php.net/php.smarty.dev/2703
Installation - Windows, IIS/Apache, PHP5
Extract files, rename Smarty.x.x.x to smarty (suggest OUTSIDE of your www root!)
Example: D:smarty
Run phpinfo.php to find out your php.ini location
//這個phpinfo.php在哪裡?沒找著,不Run也罷,往下看。
Edit php.ini's include_path and add the location of the libs folder.
//修改php.ini 尋找include_path這個欄位,照下面的方式修改,目錄名稱及路徑自己定義,只要與實際解壓目錄的路徑相同就OK了。
example: include_path = ".;D:smartylibs"
Restart IIS/Apache
Setup these two folders INSIDE your www root:
//在WEB伺服器根下建立templates和configs這兩個檔案(smarty目錄也是自己建的)
(wwwroot)/smarty/templates (this is where your templates will go)
(wwwroot)/smarty/configs
Setup these two folders OUTSIDE of your www root:
//在smarty的解壓目錄建立templates_c和cache這兩個目錄。
D:/smarty/templates_c
D:/smarty/cache
Setup security settings for the webserver to write to these four folders
//templates 、configs 、templates_c 、cache 這四個目錄必須是可寫入權限
In (wwwroot) create index.php and in (wwwroot)/smarty/templates/index.tpl with the following code:
//建立index.php及index.tpl兩個檔案測試Smarty是否安裝成功,代碼如下:
<html>
<body>
Hello, {$name}!
</body>
</html>
Now open index.php in your web browser (requested from your webserver)
//現在運行index.php,如果看到"Hello, fish boy!! "說明安裝成功