[TYPO3-english] Hot to get to constats.txt in plugin

Jigal van Hemert jigal at xs4all.nl
Tue May 4 09:01:54 CEST 2010


Dawid Pacholczyk wrote:
> How to get to file constants.txt ?
> 
> In BE everything is fine. I can go into constant editor and edit this value.
> 
> But how to get it in the php script, in main class of the extension ? The
> class extends tslib_pibase and I tried to get it via $conf variable.
> Unfortunately this didn`t give me any results. 

These constants are meant to be used in TypoScript. So, if you use them 
in your setup.txt then they are available in $conf in your extension.

The point of having constants is that they can be easily changed in the 
constants editor by administrators who find TypoScript a bit complicated.

constants.txt:

plugin.tx_myext_pi1 {
	# cat=plugin.tx_somename_pi1; type=int; label= Storage ID
	storageID = 0
}

setup.txt:

plugin.tx_myext_pi1 {
	storageID = {$plugin.tx_myext_pi1.storageID}
}


Remember to call
t3lib_extMgm::addStaticFile($_EXTKEY, 'path/to/constants/and/setup/', 
'My extension and other description of static template');
in ext_tables.php

Then you can read $conf['storageID'] in your extension script.

-- 
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh


More information about the TYPO3-english mailing list