this must be a very stupid question, but i have been searching it's answer and can't find the problem... I've got some trouble while trying to display a smarty template, i was using an older version of smarty and everything worked fine, yet i updated to smarty 3 and i got an exception, it's message saying:
Call of unknown method 'display'.
This is my code:
Index.php
require_once './GeneralFunctions.php';
$smartyVariables = getSmartyVariablesToAssign();
tryToDisplaySmartyTemplate('Index.tpl', $smartyVariables);
function getSmartyVariablesToAssign() {
$userAndOrPasswordError = $_GET['userAndOrPasswordError'];
return array(
'userAndOrPasswordError' => $userAndOrPasswordError
);
}
GeneralFunctions.php
require_once './smarty/libs/Smarty.class.php';
function tryToDisplaySmartyTemplate($templateName, $variablesToAssign = null) {
try {
$mySmarty = callSmarty();
assignSmartyVariables($mySmarty, $variablesToAssign);
$mySmarty->display($templateName);
} catch (Exception $exc) {
showCatchedExceptionTraceAndMessage($exc);
}
}
function callSmarty() {
$mySmarty = new Smarty();
$mySmarty->template_dir = 'smarty/templates';
$mySmarty->compile_dir = 'smarty/templates_c';
$mySmarty->config_dir = 'smarty/config';
$mySmarty->cache_dir = 'smarty/cache';
return $mySmarty;
}
function assignSmartyVariables($mySmarty, $variablesToAssign) {
foreach ($variablesToAssign as $key => $value) {
$mySmarty->assign($key, $value);
}
}
function showCatchedExceptionTraceAndMessage(Exception $exc) {
echo "Ocurrió un error desconocido, por favor, notifique al departamento de sistemas.",
"<br>",
"<br>",
$exc->getTraceAsString(),
"<br>",
"<br>",
$exc->getMessage();
}
I've been investigating, and all i know until now is the existence of a smarty method: testInstall() Which gives the following info:
Smarty Installation test... Testing template directory... C:\xampp\htdocs\develop\Registro_de_Tramites\smarty\templates is OK. Testing compile directory... C:\xampp\htdocs\develop\Registro_de_Tramites\smarty\templates_c is OK. Testing plugins directory... C:\xampp\htdocs\develop\Registro_de_Tramites\smarty\libs\plugins is OK. Testing cache directory... C:\xampp\htdocs\develop\Registro_de_Tramites\smarty\cache is OK. Testing configs directory... C:\xampp\htdocs\develop\Registro_de_Tramites\smarty\config is OK.
Testing sysplugin files... FAILED: files missing from libs/sysplugins: smarty_internal_extension_codeframe.php, smarty_internal_extension_config.php, smarty_internal_extension_defaulttemplatehandler.php, smarty_internal_filter_handler.php, smarty_internal_function_call_handler.php, smarty_internal_get_include_path.php.
Testing plugin files... ... OK Tests complete.
I've separated the only FAILED i've got from the rest. It seems libs/sysplugins folder is missing some php files, but downloading it all over again from smarty releases, just gives the same files i have...
To install it, i just copy libs folder into my project, inside "smarty" folder.
Hope to get some help :/