其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
用smarty打造你的留言板(一)

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

先讲讲smarty的配置,懂的请跳过这部分
---------------------------------------------------------------------------------------------------

还没有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 = '}>';

//-------------------------------------------------------------------------------
//共用模板变量替换
//-------------------------------------------------------------------------------
$smarty -> assign('banner','images/banner.jpg');

?>

(待续)




相关文章

相关软件