一个非常有好用的Smarty配置类

提供:一个一个非常有好用的Smarty配置类

<?php
define(‘PATH_PRE’,str_replace(‘\\’,'/’,dirname(__FILE__)).’/');
require_once PATH_PRE.’smarty/libs/Smarty.class.php’;
$smarty = new Smarty;
$smarty->force_compile = false;

$smarty->caching = false;
$smarty->template_dir = PATH_PRE . ‘templates’;
$smarty->compile_dir = PATH_PRE . ‘templates_c’;

function smartyDisplay($data,$template){
global $smarty;
$smarty->assign(‘data’,$data);
//echo $smarty->$template_dir;exit;
$smarty->display($template);
}

function smartyFetch($data,$template){
global $smarty;
$smarty->assign(‘data’,$data);
$tmp=$smarty->fetch($template);
}
?>

推荐阅读:smarty模板安装使用教程

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>