Re: plugin interface
| From: | Monte Ohrt | Date: | Wed, 10 Oct 2001 14:26:06 +0000 |
| Subject: | Re: plugin interface | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1664@lists.php.net to get a copy of this message | ||
Anders Janson wrote:
>
> Monte Ohrt wrote:
>
> > We've been kicking around some ideas internally, what do you think?
> >
> > Example of a plugin function in Smarty:
> >
> > *) Plugins are not registered or preloaded. They are dropped into a
> > plugins directory that Smarty has access to.
> > *) When a function is called in a Smarty template, {myfunc x=foo y=bar},
> > the following takes place:
> >
> > 1) If the function is built-in ({if ...}, {include ...}, etc.), process
> > function normally
> > 2) If a PHP function exists of the name 'smarty_func_myfunc()', use this
> > function
>
> Just a side note here: If it exists, it must have been included already.
> Then it wouldn't really be a true plugin :)
> But at least this means that custom functions does not need to be
> registered, mostly a good thing, I think.
>
Sure it could be a plugin. The first time the function is mentioned in a
template it loads the plugin. The second time it is mentioned in the
template it will exist because the plugin was already loaded.
Monte