Smarty安裝配置方法
更新時間:2008年04月10日 23:14:08 作者:
下載最新的Smarty最簡單的測試例子,以測試smarty是否安裝成功
下載最新的Smarty:http://smarty.php.net/
當前最新版本:2.6.18
解壓后將目錄中的libs目錄重命名為smarty,復制到你的網(wǎng)站目錄,同時在網(wǎng)站根目錄下建立templates和templates_c兩個目錄
建立test.php,內(nèi)容如下:
<?php
include_once('./Smarty/Smarty.class.php');$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //模板存放目錄
$smarty -> compile_dir = "./templates_c"; //編譯目錄
$smarty -> left_delimiter = "{{"; //左定界符
$smarty -> right_delimiter = "}}"; //右定界符
$smarty -> assign('test','OK');
$smarty -> display('test.html');
?>
給templates_c權(quán)限755
在templates目錄下新建test.html:
<html>
<head>
</head>
<body>
{{$test}}
</body>
</html>
打開test.php,如果看到OK就說明你的smarty安裝成功了!
當前最新版本:2.6.18
解壓后將目錄中的libs目錄重命名為smarty,復制到你的網(wǎng)站目錄,同時在網(wǎng)站根目錄下建立templates和templates_c兩個目錄
建立test.php,內(nèi)容如下:
<?php
include_once('./Smarty/Smarty.class.php');$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //模板存放目錄
$smarty -> compile_dir = "./templates_c"; //編譯目錄
$smarty -> left_delimiter = "{{"; //左定界符
$smarty -> right_delimiter = "}}"; //右定界符
$smarty -> assign('test','OK');
$smarty -> display('test.html');
?>
給templates_c權(quán)限755
在templates目錄下新建test.html:
<html>
<head>
</head>
<body>
{{$test}}
</body>
</html>
打開test.php,如果看到OK就說明你的smarty安裝成功了!
相關(guān)文章
PHP實現(xiàn)圖的鄰接矩陣表示及幾種簡單遍歷算法分析
這篇文章主要介紹了PHP實現(xiàn)圖的鄰接矩陣表示及幾種簡單遍歷算法,結(jié)合實例形式分析了php基于鄰接矩陣實現(xiàn)圖的定義及相關(guān)遍歷操作技巧,需要的朋友可以參考下2017-11-11學習php設計模式 php實現(xiàn)訪問者模式(Visitor)
這篇文章主要介紹了php設計模式中的訪問者模式,使用php實現(xiàn)訪問者模式,感興趣的小伙伴們可以參考一下2015-12-12php實現(xiàn)的Timer頁面運行時間監(jiān)測類
這篇文章主要介紹了php實現(xiàn)的Timer頁面運行時間監(jiān)測類,可實現(xiàn)按不同key檢測不同的運行時間,需要的朋友可以參考下2014-09-09