|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
archer Smarty n00b
Joined: 04 Jul 2011 Posts: 1
|
Posted: Mon Jul 04, 2011 6:35 am Post subject: Troubles with default_template_handler_func... |
|
|
Hello there!
I'm trying to migrate from Smarty 2 to Smarty 3.08. And right now, I'm facing strange problem with default_template_handler_func. Here is a hunk of code:
Code: |
<?php
require('../libs/Smarty.class.php');
$smarty = new Smarty;
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;
$template_processor->default_template_handler_func = 'handle';
function handle($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
{
$template_timestamp = time();
$template_source = 'Some text';
return true;
}
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
$smarty->display('none:index.tpl');
?>
|
Execution of the code throws an exception:
Fatal error: Uncaught exception 'SmartyException' with message 'Unkown resource type 'none'' in C:\xampp\htdocs\tmp\libs\sysplugins\smarty_internal_template.php on line 759;
SmartyException: Unkown resource type 'none' in C:\xampp\htdocs\tmp\libs\sysplugins\smarty_internal_template.php on line 759
It's seems that Smarty ignores default_template_handler_func... Can anyone explain why? What did I wrong?
Thanks. |
|
Back to top |
|
rodneyrehm Administrator
Joined: 30 Mar 2007 Posts: 674 Location: Germany, border to Switzerland
|
Posted: Mon Jul 04, 2011 9:17 am Post subject: |
|
|
The default_template_handler is (currently) not invoked for unknown resource types. Currently it is only executed for file: resources, when no valid template file is found.
Thinking about this, I believe the handler should be executed for unknown resource types as well. What do Uwe and Monte think? Change would be insignificant… |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|