smarty 挂到网申请的网站不能用

发布时间:2024-05-24 15:31 发布:上海旅游网

问题描述:

在本地做了个PHP网站
等挂到申请的空间上准备面试时
才发现该空间对smarty的代码不起作用
导致整个网站都达不到效果!
是不是smarty自身配置有问题?
可在本机一切正常啊!!!
smarty代码如下:
<?php include_once('../smarty/smarty.class.php');
$smarty=new smarty();
$smarty->config_dir='../smarty/config_file.class.php';
$smarty->templates_dir='templates';
$smarty->compile_dir='../templates_c';
$smarty->cache_dir='smarty_cache';
$smarty->left_delimiter='{';
$smarty->right_delimiter='}';
?>
请大家帮我分析分析!
网上的空间,怎么会有“错误提示”呢?
我也不知道错在哪里!
不过“路径”是相对的!!!

问题解答:

<?php require_once('smarty/Smarty.class.php');
$smarty=new Smarty();
//$smarty->config_dir='smarty/config_file.class.php';
$smarty->templates_dir='templates';
$smarty->comfile_dir='template_c';
$smarty->cache_dir='smarty_cache';
$smarty->left_delimiter='{';
$smarty->right_delimiter='}';
//$smarty->caching=true;
//$smarty->cach_lifetime=60;
?>
我想了想,如果路径没错的话可能是大小写问题。
在wamp上可能不区别大小写,但在lamp或其它环境上就
说不准了。我记得Smarty文件名与里面的类是名都是大写S开头的(Smarty)

<?php
define('SMARTY_DIR', 'smarty/');
require_once SMARTY_DIR . 'Smarty.class.php';
$smarty = new Smarty;
$smarty->template_dir = 'templates/';
$smarty->compile_dir = 'templates_c/';
$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->cache_dir='smarty_cache';
$smarty->left_delimiter='{';
$smarty->right_delimiter='}'
?>

不知道你具体反应出来的错误是什么,我以前遇到过对相对路径不太支持的情况和在服务器上不能写文件,不能够生成编译文件templates_c,IIS服务器?

可以访问下用SMARTY的页面 看他报不报错报错就好调试了
再看看SMARTY的路径是否正确

热点新闻