DATA Methods

directory()

Returns a table's data-directory. When importing tables into the system, a data-directory is assigned to a table in the backend. The data of system-tables or non-imported tables will be stored in the systems default-directory. For futher information on how to use this function and for a comparrison between this and alternative methods see our directory example!

string directory([ string name [, int format = 2 [, int root = 0 [, bool create = false ]]]])

Return

Formatted name of server-directory.

Parameter
Description
nameUsually a tablename, but a file and/or directory is also allowed. In case a tablename is passed, the root-parameter needs to be 0.
format1 = relative path: dir/...
2 = absolute path: /dir/...
3 = root path: SERVERROOT/dir/...
root0 = tables's data-directory
1 = standard data-directory
2 = user owned data
3 = internal data
4 = system data
5 = high speed cache
6 = temporary files
createCreate directory if it doesn't exist.

Get data directory of the current template's data table

$DATA->directory()
RETURN: '/data/api/'

Pass table-name to get table's data-directory

$DATA->directory("data_api_object")
RETURN: '/data/api/'

Tables that have not been imported into the system will use the standard data directory

$DATA->directory("data_api_test")
RETURN: '/data/public/'

Get name and directory of file in internal system directory

$DATA->directory('subdir/test.txt', 3, 3)
RETURN: '/var/.../.../data/intern/subdir/test.txt'

Create subdirectory in temporary data folder

$DATA->directory("example/test", 3, 6, true)
RETURN: '/var/.../.../data/temp/example/test/'