Extension Development, configuration of the extension

From TYPO3Wiki

Jump to: navigation, search

Configuration of the extension

Sometimes it is useful to configure some global variables like the upload path for the extension. To do so Typo3 supports the configuration of the extension. See Comments in TypoScript Constants-field (TS-module)

Example:

In your extension create the file ext_conf_template and write:

<TS> :
 
 # cat=basic; type=string; label= Upload Path
 uploadPath = uploads/tx_myextension
 

The first line is the configuration for the variable. The second line is the name of the variable (uploadPath) and the default value (uploads/tx_myextension).

During installation of your extension or later on you can enter and change the correct upload path, which is usually uploads/tx_myextension (like the default value). Don't forget to update the changes.

In main class of your extension you can access this configuration by:

<PHP> :
 
 $this->configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['xxxxx']);
 

where xxxxx is your extension key.

--Chibox 15:09, 12 February 2008 (CET)

Personal tools