find_in_path

The function find_in_path() returns the path of a particular function. This function is searched for in the "SPIP path".

It accepts 1 or 2 arguments:

  • the name or relative path of a file (with its extension)
  • optionally, the directory where it is stored.
$f = find_in_path("directory/file.ext");
$f = find_in_path("file.ext","directory");

Example

If the pattern/inc-special.html file exists, calculate $html as the result of compiling this template. Otherwise $html is the result of compiling pattern/inc-normal.html.

if (find_in_path("pattern/inc-special.html")) {
    $html = recuperer_fond("pattern/inc-special");
} else {
    $html = recuperer_fond("pattern/inc-normal");
}

Author Gilles Vincent Published : Updated : 30/05/10

Translations : English, français