Login / Status
developer.Resource
Home . Documentation . Document Library . Core Documentation
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

3.5. Variables and Constants

After init.php has been included in the backend there is a set of variables, constants and classes available to the parent script.

The column "Avail. in FE" is an indicator that tells you if the constant, variable or class mentioned is also available to scripts running under the frontend of the "cms" extension.

Constants

Constants normally define paths and database information. These values are global and cannot be changed when they are first defined. This is why constants are used for such vital information.

These constants are defined by either init.php or scripts included from that script.

Notice: Constants in italics may be set in a script prior to inclusion of init.php so they are optional.

Constant

Defined in

Description

Avail. in FE

TYPO3_OS

init.php

Operating systen; Windows = “WIN”, other = “” (presumed to be some sort of Unix)

YES

TYPO3_MODE

init.php

Mode of TYPO3: Set to either “FE” or “BE” depending on frontend or backend execution. So in "init.php" and "thumbs.php" this value is "BE"

YES

value = "FE"

PATH_thisScript

init.php

Abs. path to current script.

YES

TYPO3_mainDir

init.php

This is the directory of the backend administration for the sites of this TYPO3 installation. Hardcoded to “typo3/”. Must be a subdirectory to the website. See elsewhere for descriptions on how to change the default admin directory, "typo3/", to something else.

YES

PATH_typo3

init.php

Abs. path of the TYPO3 admin dir (PATH_site + TYPO3_mainDir).

-

PATH_typo3_mod

init.php

Relative path (from the PATH_typo3) to a properly configured module. Based on TYPO3_MOD_PATH.

-

PATH_site

init.php

Abs. path to directory with the frontend (one directory above PATH_typo3)

YES

PATH_t3lib

init.php

Abs. path to "t3lib/" (general TYPO3 library) within the TYPO3 admin dir

YES

PATH_typo3conf

init.php

Abs. TYPO3 configuration path (local, not part of source)

Must be defined in order for "t3lib/config_default.php" to return!

YES

TYPO3_db

config_default.php

Name of the database, for example "t3_coreinstall". Is defined after the inclusion of "typo3conf/localconf.php" (same for the other TYPO3_* constants below

YES

TYPO3_db_username

config_default.php

Database username

YES

TYPO3_db_password

config_default.php

Database password

YES

TYPO3_db_host

config_default.php

Database hostname, eg. “localhost”

YES

TYPO3_tables_script

config_default.php

By default "t3lib/stddb/tables.php" is included as the main table definition file. Alternatively this constant can be set to the filename of an alternative "tables.php" file. Must be located in "typo3conf/"

Depricated. Make Extensions instead.

YES

TYPO3_extTableDef_script

config_default.php

Name of a php-include script found in "typo3conf/" that contains php-code that further modifies the variables set by "t3lib/stddb/tables.php"

Depricated. Make Extensions instead.

YES

TYPO3_languages

config_default.php

Defines the system language keys in TYPO3s backend.

YES

TYPO3_DLOG

config_default.php

If true, calls to t3lib_div::devLog() can be made in both frontend and backend; This is event logging which can help to track debugging in general.

YES

TYPO3_MOD_PATH

[prior to init.php]

Path to module relative to PATH_typo3 (as defined in the module configuration). Must be defined prior to "init.php".

-

TYPO3_enterInstallScript

[prior to init.php]

If defined and set true the Install Tool is activated and the script exits after that. Used in "typo3/install/index.php":

Example:

define('TYPO3_enterInstallScript', '1');

-

TYPO3_PROCEED_IF_NO_USER

[prior to init.php]

If defined and set true the "init.php" script will return to the parent script even if no backend user was authenticated!

This constant is set by for instance the "index.php" script so it can include "init.php" and still show the login form:

define("TYPO3_PROCEED_IF_NO_USER", 1);

require ("init.php");

Please be very careful with this feature - use it only when you have total control of what you are doing!

-

TYPO3_cliMode

[prior to init.php]

Initiates CLI (Command Line Interface) mode. This is used when you want a shell executable PHP script to initialize a TYPO3 backend.

For more details see section about “Initialize TYPO3 backend in a PHP shell script” in “Inside TYPO3”

TYPO3_version

config_default.php

The TYPO3 version:

x.x.x for released versions,

x.x.x-dev for development versions leading up to releases

x.x.x-bx for beta-versions

YES

Global variables

Notice: Variables in italics may be set in a script prior to inclusion of "init.php" so they are optional.

Notice: The variables from "t3lib/stddb/tables.php" are only available in the frontend occasionally or partly. Please read more in the documentation of the "cms" extension on this issue.

Global variable

Defined in

Description

Avail. in FE

$TYPO3_CONF_VARS

config_default.php

TYPO3 configuration array. Please refer to the source code of "t3lib/config_default.php" where each option is described in detail as comments. The same comments are also available in the Install Tool under the menu "All Configuration"

YES

$TYPO3_LOADED_EXT

config_default.php

Array with all loaded extensions listed with a set of paths.  You can check if an extension is loaded by the function t3lib_extMgm::isLoaded($key) where $key is the extension key of the module.

YES

$TYPO3_DB

init.php

An instance of the TYPO3 DB wrapper class, t3lib_db.

You have to use this object for all interaction with the database.

t3lib_db contains mysql wrapper functions so you easily swap all hardcoded MySQL calls with function calls to $GLOBALS['TYPO3_DB']->

YES

$EXEC_TIME

config_default.php

Is set to "time()" so that the rest of the script has a common value for the script execution time.

YES

$SIM_EXEC_TIME

config_default.php

Is set to $EXEC_TIME but can be altered later in the script if we want to simulate another execution-time when selecting from eg. a database  (used in the frontend for preview of future and past dates)

YES

$TYPO_VERSION

config_default.php

Deprecated - used constant “TYPO3_version” instead!

YES

$CLIENT

init.php

Array with browser information (based on HTTP_USER_AGENT). Array keys:

“BROWSER” = msie,net,opera or blank,

“VERSION” = browser version as double,

“SYSTEM” = win,mac,unix

YES

$PARSETIME_START

init.php

Time in milliseconds right after inclusion of the configuration.

-

$PAGES_TYPES

t3lib/stddb/tables.php

See section on $TCA

(occastionally)

$ICON_TYPES

t3lib/stddb/tables.php

See section on $TCA

(occastionally)

$LANG_GENERAL_LABELS

t3lib/stddb/tables.php

See section on $TCA

(occastionally)

$TCA

t3lib/stddb/tables.php

See section on $TCA

YES, partly

$TBE_MODULES

t3lib/stddb/tables.php

The backend main/sub module structure. See section elsewhere plus sourcecode of "class.t3lib_loadmodules.php" which also includes some examples.

(occastionally)

$TBE_STYLES

t3lib/stddb/tables.php

(occastionally)

$T3_SERVICES

t3lib/stddb/tables.php

Global registration of services.

$T3_VAR

config_default.php

Space for various internal global data storage in TYPO3. Each key in this array is a data space for an application. Keys currently defined for use is:

['callUserFunction'] + ['callUserFunction_classPool']: Used by t3lib_div::callUserFunction to store persistent objects.

['getUserObj'] : User by t3lib_div::getUserObj to store persistent objects.

['RTEobj'] : Used to hold the current RTE object if any. See t3lib_BEfunc.

['ext'][extension-key] : Free space for extensions.

$FILEICONS

t3lib/stddb/tables.php

Assoc. array; keys are the type (eg. "tif") and values are the filename (without path)

(occastionally)

$WEBMOUNTS

init.php

Array of uid's to be mounted in the page-tree

(depends)

$FILEMOUNTS

init.php

Array of filepaths on the server to be mountet in the directory tree

(depends)

$BE_USER

init.php

Backend user object

(depends)

$temp_*

-

Various temporary variables are allowed to use global variables prefixed $temp_

-

$typo_db*

[config_default.php but N/A!]

Variables used inside of "typo3conf/localconf.php" to configure the database.

Notice: These values are unset again by "config_default.php".

-

$TBE_MODULES_EXT

[In ext_tables.php files of extensions]

Used to store information about modules from extensions that should be included in "function menus" of real modules. See the Extension API for details.

Unset in "config_default.php"

(occasionally)

$TCA_DESCR

[tables.php files]

Can be set to contain file references to local lang files containing TCA_DESCR labels. See section about Context Sensitive Help.

Unset in "config_default.php"