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.
  1. $f = find_in_path("directory/file.ext");
  2. $f = find_in_path("file.ext","directory");

Download

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.

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

Download

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

Translations : English, français