Author: renato@rezo.net
Date: 2007-05-21 16:32:09 +0200 (lun, 21 mai 2007)
New Revision: 9344
Log:
the pipeline insert_js is called two times with a different argument {{{$flux['type']}}} that request injection of inline or file scripts;
{{{$flux['type']}}} can be "inline" or "fichier";
Inline call makes it possible to inject scripts:
1) that cannot be packed because of limits of the php compressor
2) that are templates themselves, therefore needing a specific {{{<script src="spip.php?page=....">}}} tag
3) that is better to view as part of the head rather than to be consolidated in jquery.js.html
Modified:
spip/dist/jquery.js.html
spip/ecrire/inc/filtres.php
Details: http://trac.rezo.net/trac/spip/changeset/9344
renato@rezo.net a écrit :
Author: renato@rezo.net
Date: 2007-05-21 16:32:09 +0200 (lun, 21 mai 2007)
New Revision: 9344
Log:
the pipeline insert_js is called two times with a different argument {{{$flux['type']}}} that request injection of inline or file scripts;
it looks like insert_js where not a pipeline as the input is an array('type'=>xxx) and the output a list of scripts.
So it can works only on first function called in the pipeline. The next fonctions will not have any information about what is required.
we can have two pipelines :
insert_js_inline
insert_js_script
or you can use the syntax
pipeline('insert_js',$flux=>array('args'=>array('type'=>xx),'data'=>''))
where each function has ton insert it's data on $flux['data'] that will be returned at end
If i understand well your mecanism :
plugins can insert javascript needed with
- pipeline(s) insert_js
- function call ajouter_js_affichage_final($page,$script), but only from a function in the pipeline affichage_final
One type of adding is missing here :
some js (or css, the need is the same) are needed only when a model or a skeleton is used.
for this kind of use, where the need of css and js is only on some page of the website, i think the best way is to write it inline inside models and skeletons and have a final function in pipeline affichage_final that collect all and add it into the head section
I'll made some try to see that