[dev] potential optimizations: static css and javascript

Jan Schneider jan at horde.org
Sun Oct 17 03:20:09 PDT 2004


Zitat von Chuck Hagenbuch <chuck at horde.org>:

> Quoting Jan Schneider <jan at horde.org>:
>
>>> While I was at it, it seemed prudent to add a js/ directory as well for .js
>>> files that really are static and don't need *any* PHP; no reason to involve
>>> javascript.php in those.
>>
>> This is already possible, but the .js files can sit in any directory, like
>> htmlarea.js in services/editor/htmlarea/ for example. But of course these
>> files need to be in an accessable directory, i.e. not in templates.
>>
>> What I actually want to say is, yes, why not.
>
> :)
>
>>> The files that really do need PHP can stay in
>>> templates/javascript but be renamed to .php, and Horde::addScriptFile() can
>>> check the file extension to figure out where to find it.
>>
>> Lost you here.
>
> If we take the javascript files that contain some php code, and leave them in
> templates/javascript, but change them to be file.php instead of file.js, then
> we can use Horde::addScriptFile() to add both static (/js/foo.js) and dynamic
> (javascript.php / templates/javascript/foo.js) by having Horde::addScriptFile
> check the extension (.php or .js) of the file that's passed in, and thus have
> it do the right thing (use javascript.php, or use a direct url).

Ah, understood. But this is not necessary, see above. There already is a
parameter to addScriptFile that defines the path to be an absolute path to
a static js file. No file extension magic.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the dev mailing list