include_spip

The function include_spip() includes a PHP file. The difference from PHP’s normal include_once() is that the file is searched for in the SPIP path, that is, in all the known directories and in the search priority order specified in the SPIP path.

include_spip() accepts 1 or 2 arguments and returns the address of the file found:

  • the name or relative path of the file (without its .php extension)
  • a flag called inclure (true by default) that indicates if the file is actually to be included, or if only the path of the file is to be returned.
  1. include_spip('filename');
  2. include_spip('directory/filename');
  3. $address = include_spip('filename');
  4. $address = include_spip('filename', false); // inclusion is not performed

Download

Example

Load the functions file for "mini présentations" so that we can call the minipres function to display an error page.

  1. include_spip('inc/minipres');
  2. echo minipres('Bad luck!', 'An error has occurred!');

Download

Author Gilles Vincent Published : Updated : 13/10/10

Translations : English, français