Re: [SMARTY] Plugindir
| From: | Jan Rosier | Date: | Fri, 12 Apr 2002 13:28:36 +0000 |
| Subject: | Re: [SMARTY] Plugindir | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-52@lists.php.net to get a copy of this message | ||
I'm legging a bit behide in the discusion, but still some thoughts:
If one uses {include_php file="myScript.php"} in a template the compiler
basicly replaces it with <?php include("myScript.php"); ?>'; plus some
extras. That is just fine if the scripts is somewhere in the include_path of
PHP. When PHP should find it and do the job. ;-)
( use .htaccess => php_value include_path
.:/path/to/my/php/scripts/php-include to set the path)
The problem arises when the compiler tries to find the file in the function
_get_php_resource (line 712 of Smarty.class.php). This will return that the
file is not readable and than the compiler will stop and complane ;-). Maybe
the include_path could be take in account here.
The same goes I think for {insert name="getBanner" script="myScript.php"}.
The function _run_insert_handler also uses function _get_php_resource to
find the file myScript.php
If the include_path could be take in account here. One could choose this own
directory to place it's scripts...
An other thought is this
Smarty/
Smarty/plugins/
Smarty/plugins/function/
Smarty/plugins/modifier/
Smarty/plugins/insert/
etc.
Then put the plugins in a subdirectory acording to there name. Then no
seaching is required and one can put his own scripts in the subdirectory
Well just my 2 cents...
Greeting Jan Rosier.
----- Original Message -----
From: "Andreas Kossmeier" <andreas.kossmeier@bergfex.at>
To: <smarty-general@lists.php.net>
Sent: Tuesday, April 09, 2002 11:28 PM
Subject: Re: [SMARTY] Re: [SMARTY-GENERAL] Plugindir
> Andrei Zmievski wrote:
> > No, it can't. Consider what happens, with your suggestion, when a
> > template uses modifier 'foo' and the modifier is implemented as a
> > plugin. At compilation time you check for plugin's existence and when
> > _load_plugins() is called it will only load the file without checking
> > for anything. It will work fine the first time, but subsequently the
> > compilation does not happen until the template is updated. The plugin
> > file, however, may have been removed and now _load_plugin() will produce
> > a bunch of PHP error messages.
>
> you could check the file_existance again at run-time, you still don't
> need to scan for plugins in several directories. another problem could
> be a moved plugin. you would have to recompile the template to get the
> new location.
>
> any other suggestions avoiding scanning for plugins at run-time?
>
> --
> andreas kossmeier
> bergfex.at - http://www.bergfex.at
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php