Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Troubles with default_template_handler_func...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
archer
Smarty n00b


Joined: 04 Jul 2011
Posts: 1

PostPosted: Mon Jul 04, 2011 6:35 am    Post subject: Troubles with default_template_handler_func... Reply with quote

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
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Mon Jul 04, 2011 9:17 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP