Skip navigation.

exploreopera

| Help

Sign up | Help

SPIP commits

Posts tagged with "documentation"

The parameter "var_mode" detailled

, ,

4 values can be used :

  • ?var_mode=preview : enables to display an article without publishing it.
  • ?var_mode=calcul : refreshes the cache
  • ?var_mode=recalcul : regenerates the templates and refreshes the cache
  • ?var_mode=debug : shows informations relating to the page calculation


Generally you must be authenticated to use these parameters. The debug mode is accessible to admins only.

[11440] SQL views in the API

, , ,

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');

What is a SPIP pipeline ? It's a hook

, ,

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)