Documentation

GetDirIndex

string
GetDirIndex(
 string path,
 string DirIndex = false
);

The function returns the name of a directory index file.

Function parameters

ParameterDescription
path Path to directory relative to root to which an index file is to be returned.
DirIndex Possible names of index files separated with spaces, in descending priority order.
If run under an Apache server, pass the DirectoryIndex field value of web server settings in this parameter. For IIS, this parameter can be found in the site properties, tab "Documents" -> "Enable default content page".
Optional parameter. By default - "false" (the value will be taken from the DIRECTORY_INDEX constant; if the constant is not defined the value - "index.php index.html index.htm index.phtml default.html index.php3" is used by default).

The following algorithm is used to find a directory index file:

  1. A value from the parameter index is taken. If the parameter is not specified the value of the constant DIRECTORY_INDEX is taken. This constant can be defined in the file /bitrix/php_interface/dbconn.php or in files /bitrix/php_interface/ID сайта/init.php). If the constant value is not specified the value "index.php index.html index.htm index.phtml default.html index.php3" is used by default.
  2. The obtained value is tokenized by spaces into separate file names.
  3. Each file is checked for existence in the directory.
  4. The first found file is considered the directory index page.

See Also



© «Bitrix24», 2001-2024
Up