关于一个smarty的问题!!! 想问下 我的smarty 怎么指向别的路径呢?也就是说 我includ文件夹下的1.php 要对应templates下的includ文件夹下的1.html 应该怎么对应呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 首先要下载smarty并把相关文件存放在网站上//以下文件为common.inc.php$global['path']['root'] = dirname(__FILE__) . '/'; //网站根目录$global['path']['conf'] = $global['path']['root'] . 'conf/';$global['path']['themes'] = $global['path']['root'] . 'templates/includ/';require($global['path']['conf'] . 'smarty.cfg.php'); /* smarty.cfg.php smarty缓存的设置 具体可以参考smarty手册$global['smarty']['template_dir'] = $global['path']['themes']; //smarty缓存文件存放的目录,我这边是 themes/default/$global['smarty']['compile_dir'] = $global['path']['root'] . 'tmp/templates_c/';$global['smarty']['config_dir'] = $global['path']['conf'] . 'smarty/';$global['smarty']['cache_dir'] = $global['path']['cache'] . 'smarty/';$global['smarty']['caching'] = 0;$global['smarty']['cache_lifetime'] = 6000;$global['smarty']['left_delimiter'] = '<!--{';$global['smarty']['right_delimiter'] = '}-->';*/require($global['path']['conf'] . 'smarty/libs/Smarty.class.php'); //包含smarty类,我这边是放在 /conf/smarty/libs/下面,根据你的路径调整$smarty = new Smarty();$smarty->template_dir = $global['smarty']['template_dir'];$smarty->compile_dir = $global['smarty']['compile_dir'];$smarty->config_dir = $global['smarty']['config_dir'];$smarty->cache_dir = $global['smarty']['cache_dir'];//$smarty->compile_check = $global['smarty']['compile_check'];//$smarty->debugging = $global['smarty']['debugging'];$smarty->caching = $global['smarty']['caching'];$smarty->cache_lifetime = $global['smarty']['cache_lifetime'];$smarty->left_delimiter = $global['smarty']['left_delimiter'];$smarty->right_delimiter = $global['smarty']['right_delimiter'];$smarty->trusted_dir = $global['path']['root'];你的include/1.php可以这样写require('common.inc.php');$smarty->assign('page',$list); //装载数据$smarty->display($global['path']['themes'] . '1.html'); //这个地方是1.PHP文件 对应的模板文件大体这样。。不便之处,你自行调整了。呵 exec函数无法执行 js 显示问题 生成树结构过程中遇到的问题,请帮忙解决 php中的::是什么意思 新完成一个网站,散分! 如何生成不同的随机数或者字符串 询问关于"QQ秀"的原理~~~~~~~~~~ 靠,怎么提交不上呢。 气死了 递归引用问题 bbcode解析时遇见的两个问题! php實現偽靜態 谁有WIN2003下iis/apache+php+mysql成功配置的文档啊?
$global['path']['conf'] = $global['path']['root'] . 'conf/';$global['path']['themes'] = $global['path']['root'] . 'templates/includ/';require($global['path']['conf'] . 'smarty.cfg.php');
/* smarty.cfg.php smarty缓存的设置 具体可以参考smarty手册
$global['smarty']['template_dir'] = $global['path']['themes']; //smarty缓存文件存放的目录,我这边是 themes/default/
$global['smarty']['compile_dir'] = $global['path']['root'] . 'tmp/templates_c/';
$global['smarty']['config_dir'] = $global['path']['conf'] . 'smarty/';
$global['smarty']['cache_dir'] = $global['path']['cache'] . 'smarty/';
$global['smarty']['caching'] = 0;
$global['smarty']['cache_lifetime'] = 6000;
$global['smarty']['left_delimiter'] = '<!--{';
$global['smarty']['right_delimiter'] = '}-->';*/
require($global['path']['conf'] . 'smarty/libs/Smarty.class.php'); //包含smarty类,我这边是放在 /conf/smarty/libs/下面,根据你的路径调整
$smarty = new Smarty();
$smarty->template_dir = $global['smarty']['template_dir'];
$smarty->compile_dir = $global['smarty']['compile_dir'];
$smarty->config_dir = $global['smarty']['config_dir'];
$smarty->cache_dir = $global['smarty']['cache_dir'];//$smarty->compile_check = $global['smarty']['compile_check'];
//$smarty->debugging = $global['smarty']['debugging'];
$smarty->caching = $global['smarty']['caching'];
$smarty->cache_lifetime = $global['smarty']['cache_lifetime'];$smarty->left_delimiter = $global['smarty']['left_delimiter'];
$smarty->right_delimiter = $global['smarty']['right_delimiter'];
$smarty->trusted_dir = $global['path']['root'];
你的include/1.php可以这样写
require('common.inc.php');
$smarty->assign('page',$list); //装载数据
$smarty->display($global['path']['themes'] . '1.html'); //这个地方是1.PHP文件 对应的模板文件大体这样。。不便之处,你自行调整了。呵