Friday, 25. April 2008, 10:59:00
commit, api, criteria
For exemple, the function
critere_AUTEURS_recherche_dist() overwrites the criteria
recherche for the loop AUTEURS only. The priority order is :
- critere_TABLE_nomcrit()
- critere_TABLE_nomcrit_dist()
- critere_nomcrit()
- critere_nomcrit_dist()
Saturday, 12. April 2008, 10:56:06
commit, SQL, api, documentation
3 new functions enable to create and delete views for PG, SQlite and MySQL :
- sql_get_select() : same arguments as sql_select() but returns the query without evaluating it
- sql_create_view($view_name, $select_request) : creates the view $view_name for the select request $select_request.
- sql_drop_view($view_name) : drops the view.
/!\ Warning ! Yous must give an explicit name to every field prefixed with a table name or an alias. Elsewhere SQLite won't be able to read the view (which contains 'a.titre' instead of 'titre').
Example :
$sel = sql_get_select(
array(
'id_article'=>'id_article',
'titre'=>'titre'
),
'spip_articles');
echo "requete select : $sel<br />";
sql_create_view('vue_nom', $sel);
$res = sql_select(array('id_article', 'titre'),'vue_nom',,,,'10');
if ($res){
while ($r = sql_fetch($res)){
echo "*" . $r['id_article'] . " - " . $r['titre'] . "<br />";
}
}
sql_drop_view('vue_nom');
Wednesday, 2. April 2008, 22:59:31
plugins, api, documentation
During the normal execution of several commands, call-outs are made to optional scripts that allow a developer to add functionality or checking. Typically, the hooks allow for a command to change the values of function arguments before any other call, and allow for a post-processing treatment that will always change the function result.
Exemple :
function prefix_treatment($flow) {
/* add something to the flow */
$flow .= 'This is some html code';
return $flow;
}plugin.xml defines the implemented hooks with a list of
<pipeline> tags:
<pipeline>
<nom>point_entree</nom>
<action>fonction</action>
<inclure>fichier.php</inclure>
</pipeline>
- <nom> : name of the hook (from a list defined in ecrire/inc_version.php)
- <action> : function name without it's prefix
- <inclure> : file name that defines the previous function. It's name must be prefix_action
(src :
http://doc.spip.org/@Tuto-Se-servir-des-points-d-entree)
Tuesday, 25. March 2008, 10:59:00
commit, api, criterion
For exemple
critere_AUTEURS_recherche_dist() will overwrite the criterion
recherche for the loops over AUTEURS. The priority order is :
- critere_TABLE_nomcrit
- critere_TABLE_nomcrit_dist
- critere_nomcrit
- critere_nomcrit_dist
Wednesday, 12. March 2008, 18:00:00
template, commit, api, ajax
...
<INCLURE{fond=fond/ajax}{fond_ajax=mon_fond}{id_truc=xx}..>
includes the template and ajaxifies all it's links.
By default, the javascript variable "ajaxbloc_selecteur" is used. It transforms into ajax call each link that corresponds to the jquery selector '.pagination a,a.ajax'.
An ajax call refreshes the template's result by restauring it's #ENV, plus some parameters in the url.
When a refresh occurs, the bloc's opacity is changed to 50% and it's class to 'loading' (this div is automatically created)
The loaded part is cached on the browser with javascript. It also can be preloaded by adding the class 'preload' to the corresponding links.
That's all !
(src :
http://thread.gmane.org/gmane.comp.web.spip.devel/46569)
Tuesday, 29. January 2008, 12:00:00
api, howto, tag, trick
in PHP : Each plugin defines a constant corresponding to it's execution path
if (defined('_DIR_PLUGIN_XXX')){ ... }inside a template : #PLUGIN and conditionnal evaluation does your job !
[(#PLUGIN{XXX}) doSomething ]
Monday, 14. January 2008, 06:46:05
api, commit, private area, dist
Big change in the private area API :
afficher_contenu_objet() is simplified and know uses a customizable template for every (standard?) table.
The result of this template uses a pipeline ('afficher_contenu_objet'), and so plugins can modify it .
This commit creates a directory 'dist/contenu/' that contains article.html, breve.html, etc.
Really usefull for customisation of the private area, no ?