Typo3: variables, editable in backend

July 15, 2015 at 06:15

There is an easy way to define minor variables and make them editable in the typo3 backend. It can be done via extension settings. Just add in the constants.txt:
# cat=plugin.tx_extensionname//a; type=int+; label=How many loops should there be?
loopCount = 5
# cat=plugin.tx_extensionname//b; type=boolean; label= Do the cronjob?
doCronjob = 1
Whats important is the seemingly commented line above the variables, it is to define a type (here is a list of possible types) and a label. In typo3 just click on "Template" on the left (while having selected the template page). In the dropdown on top select "constant editor" and then the tx_extensionname should appear in the dropdown below. To make this available via $this->settings in the cronjob, add the following to the setup.txt:
plugin.tx_extensionname {
    settings {
        loopCount = {$plugin.tx_extensionname.settings.loopCount}
        doCronjob = {$plugin.tx_extensionname.settings.doCronjob}
module.tx_extensionname < plugin.tx_extensionname

Tags: extbase Extension typo3 backend variables

Hinterlasse einen Kommentar: