IntroductionIntroduction
  CGI and SSICGI and SSI
  <pike> tag<pike> tag
  Pike scriptPike script
  ModulesModules
  Parser modulesParser modules
  Location modulesLocation modules
    <find_dir()>find_dir()<find_dir()>find_dir()
    <find_file()>find_file()<find_file()>find_file()
    <query_location()>query_location()<query_location()>query_location()
    <real_file()>real_file()<real_file()>real_file()
    <stat_file()>stat_file()<stat_file()>stat_file()
  Other module typesOther module types
  Request information objectRequest information object
  ResponsesResponses
  Library methodsLibrary methods
 
find_file()

mixed find_file(string path, object id)

The find_file() method is the fundamental method of a location module, that all location modules need to implement. It is called when a request is made for an URL within the modules mount point. path contains the path to the object, in the modules name space. id contains the request information object.

That the path is in the modules name space means that the path will only contain the part of the URL after the modules mount point. If a module is mounted on /test/ and a user requests http://my.server/test/files/img/hej.gif the module will be called with a path of files/img/hej.gif. That way the administrator can set the mount point to anything she wants, and the module will keep working.

If the module could not find the requested object the return value is zero. In that case Challenger will move on and try to find in in other location modules. If the requested object is a directory the return value is minus one, in which case the request will be handled by a directory type module.

If the module could handle the request the return value is either a mapping created with one of the response methods, see the responses chapter, or a Stdio.File object containing the requested file.