0
votes

I have a smarty structure like this

/
/cache
/configs
/libs
/templates
/templates/administrator
/cache
/administrator

I want the same template structure assign to my administrator folder. I am getting error :

"Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'administrator/index.tpl"

The Code I am using is

$t = new smarty;
$t->setTemplateDir('.' . DS . 'templates/administrator' . DS)
        ->setCompileDir('.' . DS . 'templates_c' . DS)
        ->setPluginsDir(SMARTY_PLUGINS_DIR)
        ->setCacheDir('.' . DS . 'cache' . DS)
        ->setConfigDir('.' . DS . 'configs' . DS);
2

2 Answers

0
votes

If the template is actually templates/administrator/index.tpl, then it should be referenced as

$t->display('index.tpl');

since you have set template_dir to templates/administrator. From the error, it appears you have attempted

$t->display('administrator/index.tpl');

If that is not the case, please update your question to show the display() call as well as the contents of templates/administrator.

0
votes

I got the solution: I have created the template directory for the administrator