|
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 |
Ceph Smarty Rookie
Joined: 25 Nov 2003 Posts: 24
|
Posted: Fri Jun 04, 2004 5:31 am Post subject: Bug with custom resource handlers |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Jun 04, 2004 7:29 am Post subject: |
|
|
I cannot reprodude this.
I don't get the resoure-name prepended on source() or timestamp(). |
|
Back to top |
|
Ceph Smarty Rookie
Joined: 25 Nov 2003 Posts: 24
|
Posted: Fri Jun 04, 2004 5:13 pm Post subject: |
|
|
[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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Jun 04, 2004 6:36 pm Post subject: |
|
|
which smarty-version?
which php-version?
i cannot reproduce this problem. |
|
Back to top |
|
Ceph Smarty Rookie
Joined: 25 Nov 2003 Posts: 24
|
Posted: Fri Jun 04, 2004 6:39 pm Post subject: |
|
|
PHP 4.3.7 (win32 precompiled), Smarty 2.6.2 (clean copy), WinXP, Apache2.? |
|
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
|