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

Bug with custom resource handlers

 
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 -> Bugs
View previous topic :: View next topic  
Author Message
Ceph
Smarty Rookie


Joined: 25 Nov 2003
Posts: 24

PostPosted: Fri Jun 04, 2004 5:31 am    Post subject: Bug with custom resource handlers Reply with quote

the $tpl_name passed to custom resource handlers is not consistent. I wrote a custom resource handler called 'dbemail' and registered it with:

Code:
$this->register_resource( "dbemail", array "smarty_resource_dbemail_source",
"smarty_resource_dbemail_timestamp",
"smarty_resource_dbemail_secure",
"smarty_resource_dbemail_trusted" ) );


The source function gets the template name like: dbemail:1 (with the full resource identifier dbemail: attached. The timestamp function gets the identifier as simply 1. I would think the latter would be the more correct behavior.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Jun 04, 2004 7:29 am    Post subject: Reply with quote

I cannot reprodude this.
I don't get the resoure-name prepended on source() or timestamp().
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ceph
Smarty Rookie


Joined: 25 Nov 2003
Posts: 24

PostPosted: Fri Jun 04, 2004 5:13 pm    Post subject: Reply with quote

[php:1:4775012ff7]class EmailSmarty extends Smarty
{
function EmailSmarty( $id, &$params )
{
$this->compile_dir = "c:/www/compiled/email";
$this->use_sub_dirs = true;

$this->register_resource( "test", array( "testsource",
"testtimestamp",
"testecure",
"testtrusted" ) );
$body = $this->fetch( "test:{$id}" );
echo $body;
}
}[/php:1:4775012ff7]

resource.test.php
[php:1:4775012ff7]function testsource($name, &$source, &$smarty) {
echo "testsource({$name})<br>";
return true;
}

function testtimestamp($name, &$timestamp, &$smarty) {
echo "testtimestamp({$name})<br>";
return true;
}

function testsecure($name, &$smarty) {
echo "testsecure({$name})<br>";
return true;
}

function testtrusted($name, &$smarty) {
}[/php:1:4775012ff7]

gives me:

testsource(test:1)
testtimestamp(1)
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Jun 04, 2004 6:36 pm    Post subject: Reply with quote

which smarty-version?
which php-version?

i cannot reproduce this problem.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ceph
Smarty Rookie


Joined: 25 Nov 2003
Posts: 24

PostPosted: Fri Jun 04, 2004 6:39 pm    Post subject: Reply with quote

PHP 4.3.7 (win32 precompiled), Smarty 2.6.2 (clean copy), WinXP, Apache2.?
Back to top
View user's profile Send private message
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 -> Bugs 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