Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > Overloading a _dist function

Overloading a _dist function

Many of the functions in SPIP are designed to be overridden. These functions have the extension “_dist” in their name. All the balises (“tags”), boucles (“loops”), and criteres (“criteria”) are named like this and can thus be overridden by declaring exactly the same function, but without the suffix “_dist” in the name.

For example, the ecrire/public/boucles.php file contains a function called boucle_ARTICLES_dist. It can be overloaded by declaring a function like this:

  1. function boucle_ARTICLES($id_boucle, &$boucles) {
  2. ...
  3. }


Where do I store the override functions?

These declarations can be made in a plugin, in the squelettes folder, or in an options of functions custom file. Anything that relates to construction of squelette templates (tag, loop, filter or criteria functions) can be overloaded in a function file such as "mes_fonctions.php". Other functions that can be called outside of using a template should be overloaded in an options file such as mes_options.php, which is reloaded every time a page call is requested for the site.