Search code examples
typo3typo3-7.6.xtypo3-8.xtypo3-7.xtypo3-8.7.x

TYPO3: Custom Globals?


I have some data (logins) I want to be ignored from git in my custom TYPO3 extension code.

As AdditionalConfiguration.php is already ignored in my case, it seems a good place to store such data.

It normally contains Data like

$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']

Now would it make sense to make something like custom globals? Does that exist?

$GLOBALS['CUSTOM_CONF_VARS']['MYEXT']['username']

Should and can I do that or not?


Solution

  • I think you can use your own globals. But I would consider using your own globals as bad programming style.
    If you have installation specific data the right way to store the data depends on the kind of data and where you need it:

    • everything for the Frondend should be stored in typoscript. This can be in a file from a site-extension or in the database (template record)
    • for BE you could use Page- or User-TSconfig. here you also can use a file from a site-extension or database records (pages/be_user)
    • if you have FE and BE or anything alse (e.g. scheduler jobs) you can use extension specific global data, you can set in the extension manager. -> docs.