求助:模板文件出错
我有这样的Smarty设置:
require_once 'smarty/Smarty.class.php';
$smarty = new Smarty();
$smarty->compile_dir = $compile_dir;
$smarty->template_dir = $tpl_dir;
这就是我现在应该需要的……我为其他网站设置了完全像这样的Smarty,它在同一台服务器上工作得很好.
var_dump($smarty)输出所有公共变量,$smarty-> template_exists(“index.tpl”)返回1,这两者都表明Smarty已正确设置并正常工作,但是,$smarty-> display(“ index.tpl“)和$output = $smarty-> fetch(”index.tpl“); echo $output;输出空白页面. index.tpl文件肯定包含HTML.
我忘记了一些步骤还是什么?
编辑:
添加
ini_set('display_errors', true);
error_reporting(E_ALL + E_NOTICE);
还为Smarty创建了配置目录.
并试过$output = $smarty-> fetch(“index.tpl”);后续代码var_dump($输出).
还是空白页面.
如果我回应“foo”;在$smarty-> display(“index.tpl”)之前它会输出该行,但是如果我在它之后执行它,它就不会输出它.