find. Finding file on disk

^file:find[file]
^file:find[file]{code to be executed if file is not found}

The method returns a string (object of class
string) containing name of file and full path if it exists in specified directory or in any of the parent directories. Otherwise, if a code is specified, it will be executed.

Example without path
<img src="^file:find[header.gif]{/i/header.gif}">

Assume, the code is located in
/news/sport/index.html. Then, the file header.gif will be searched within /news/sport/ intended solely for sports news. In case it cannot be found, and /news/sports/header.gif doesn't exist, a standard headline image for news section will be used.

Example with path specified
<img src="^file:find[/i/$section/$subsection/header.gif]">

File
header.gif will be searched within /i/section/subsection/. If it still cannot be found, it will be looked for in (in the order as follows):
·/i/section/  
·/i/  
·/  



Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 30.03.2004