Savant3 template engine error, examine fetch() result

1.2k Views Asked by At

i try to use Savant3 but i have always the same error message:

error, examine fetch() result

My wbx.php containing :

session_start();
// include Savant class file
require_once 'lib/Savant3.php';
require_once 'lib/gemel.php';

// initialize template engine
$savant = new Savant3();

// assign template variables
$gemel = new Gemel;
$savant->aliasRead = $gemel->getAlias($username, $domain);


// interpolate variables and display template
$savant->display('template/test.tpl');

And my tpl is a simple template in html. If i try in my wbx.php a var_dump('$savant->aliasRead'); it's work so it's my template who creat this error.

The location is correct, and my tpl is in template/

But it doesn't work, don't understand why...

2

There are 2 best solutions below

1
Adder On BEST ANSWER

Maybe construct the Savant3 object as:

$config = array(
    'template_path' => array('template')
);  
$savant = new Savant3($config);
0
RPDeshaies On

When you have that error message, in my case, it meant that Savant is trying to display a template that does not exist.

You could do a echo "<pre> fetch : "; print_r($savant->fetch()); echo "</pre>"; to see more information about the error.

But you need to place this code after the code that displays your template.

Hope it will help someone