Re: [SMARTY] bug in block_function handling?
| From: | boots | Date: | Wed, 20 Oct 2004 20:09:06 +0000 |
| Subject: | Re: [SMARTY] bug in block_function handling? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11900@lists.php.net to get a copy of this message | ||
--- Paolo Nesti Poggi <pnp@italyflash.com> wrote:
> inside my php application it is included and registered by doing:
>
>
include_once('Smarty/Smarty_nocache_cmpt/block.php_component_nc.php');//on
> the include dir path
> $smartyDisplay->register_block('php_component_nc',
> 'php_component_nc',
> false);
>
> Now if I run it with:
> $this->caching=false;
>
> everything is all right but when
> $this->caching=true;
>
> I get:
> Fatal error: Smarty error: [in candidate/it.tpl line 29]: [plugin]
> could not
> load plugin file 'block.php_component_nc.php' (core.load_plugins.php,
> line
> 118) in /usr/share/munk_php/Smarty-2.6.6/libs/Smarty.class.php on
> line 1088
Well, the naming convention is only used for autoloaded plugins. Since
autoloaded plugins are always cachable (there is no naming convention
for non-cachable plugins, atm) you must register them, much like you
are doing. The difference is that when you manually register a plugin,
Smarty does NOT use the naming convention. Thus:
$smartyDisplay->register_block('php_component_nc',
'smarty_block_php_component_nc', false);
is the correct way to register your plugin. I suspect that since your
registration is incorrect, Smarty is trying to autoload the plugin and
thus your error. This should also explain why the examples in the
manual do not follow the naming convention: they are manual
registrations.
I haven't looked intensely at your example, so I may have missed
something, but I suspect that this is the reason you are having that
issue.
Greetings,
xo boots