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.
include_spip('filename');
include_spip('directory/filename');
$address = include_spip('filename');
$address = include_spip('filename', false); // inclusion is not performed

Example

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

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

Author Gilles Vincent Published : Updated : 12/03/23

Translations : English, français, Nederlands