Attention

TYPO3 v7 has reached its end-of-life November 30th, 2018 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.

There is no further ELTS support. It is recommended that you upgrade your project and use a supported version of TYPO3.

Configuration files

Files ext_tables.php and ext_localconf.php are the two most important files for the execution of extensions within TYPO3. They contain configuration used by the system on almost every request. They should therefore be optimized for speed.

  • ext_localconf.php is always included in global scope of the script, either frontend or backend.

    While you can put functions and classes into the script, it is a really bad practice because such classes and functions would always be loaded. It is better to have them included only as needed.

    So stick to changing values in TYPO3_CONF_VARS only!

  • ext_tables.php is not always included in global scope (in the frontend)

    It should still not contain functions and classes as it still very often loaded.

  • Use the API of class extMgm for tasks such as adding tables, merging information into arrays, etc.

  • Before the inclusion of any of the two files, the variables $_EXTKEY is set to the extension key and $_EXTCONF is set to the configuration from $TYPO3_CONF_VARS["EXT"]["extConf"][extension key]

  • $TYPO3_LOADED_EXT[extension key] contains information about whether the module is loaded as local, global or system type, including the proper paths you might use, absolute and relative.

  • The inclusion can happen in two ways:

    • Either the files are included individually on each request (many file includes) ($TYPO3_CONF_VARS["EXT"]["extCache"]=0;)

    • or (better) the files are automatically imploded into one single temporary file (cached) in typo3temp/Cache/Code/cache_core directory (only one file include) ($TYPO3_CONF_VARS["EXT"]["extCache"]=1;). This is default.

    In effect this means:

    • Your ext_tables.php and ext_localconf.php file must be designed so that they can safely be read and subsequently imploded into one single file with all the other configuration scripts!

    • You must never use a "return" statement in the files global scope - that would make the cached script concept break.

    • You should not rely on the PHP constant __FILE__ for detection of include path of the script - the configuration might be executed from a cached script and therefore such information should be derived from the $TYPO3_LOADED_EXT[extension key] array, e.g. $TYPO3_LOADED_EXT[$_EXTKEY]["siteRelPath"].