还没有smarty的请先到http://smarty.php.net下载,目前最新版本是2.6.3,下载后解压,只需把其中的libs目录拷
贝到你的Web根目录下,接着在web目录下再建几个子目录:templates     //存放模板
templates_c //存放被编译的文件
configs       //存放配置文件
cache         //存放缓存文件
上面四个是smarty需要设定的为了方便规划,再建几个目录
function       //存放自定义函数
inc               //存放头文件
js                //脚本文件
css             //样式表
images       //图片另外,libs目录除了smarty类外,还可把自己写的类也放在这里面,方便规划下面是在文件中的设置,请将此文件保存在inc目录中,以便调用<?php
/*==============================================================================
*
* 文 件 名: smarty.inc.php
* 程序功能: smarty设置
* 更新时间: 2004-08-29
*
* 程序设计: Jzealot 
*  E-mail : [email protected]
*
*===============================================================================*/require("./libs/Smarty.class.php");
$smarty = new Smarty();//-------------------------------------------------------------------------------
//指定功能目录(模板,编译,配置,缓存)
//-------------------------------------------------------------------------------
$smarty -> templatfe_dir  = './templates';
$smarty -> compile_dir    = './templates_c';
$smarty -> config_dir     = './configs';
$smarty -> cache_dir      = './cache';
//$smarty -> caching        = true;
//$smarty -> cache_lifetime = 300;
//-------------------------------------------------------------------------------
//模板边界符设定,主要是防止标签冲突
//-------------------------------------------------------------------------------
$smarty -> left_delimiter  = '<{';
$smarty -> right_delimiter = '}>';?>