TheMagician TheMagician - 3 months ago 27
PHP Question

Smarty outputs blank page

SOLVED: Error in template file

I have Smarty setup like this:

require_once 'smarty/Smarty.class.php';
$smarty = new Smarty();

$smarty->compile_dir = $compile_dir;
$smarty->template_dir = $tpl_dir;

That's all I should need for now... I have Smarty setup exactly like this for another site and it works just fine on the same server.

outputs all its public variables and
, which would both indicate that Smarty is properly setup and working, however, both
$output = $smarty->fetch("index.tpl"); echo $output;
outputs blank page. And the index.tpl file certainly contains HTML.

Have I forgotten some step or what?



ini_set('display_errors', true);
error_reporting(E_ALL + E_NOTICE);

Also created config directory for Smarty.

And tried
$output = $smarty->fetch("index.tpl"); var_dump($output)

Still blank page.

If I
echo "foo";
it outputs the line, but if I do it after it, it doesn't output it.


I had additional {} (without $) variables in the template file that were supposed to be implemented later in the code, assuming Smarty would just replace those with blank I didn't think it could be those causing the problem, but after removing them it worked fine.