Quantcast
Channel: Insane in the Main Frame
Viewing all articles
Browse latest Browse all 310

Typo3: variables, editable in backend

$
0
0

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:

  1. # cat=plugin.tx_extensionname//a; type=int+; label=How many loops should there be?
  2. loopCount = 5
  3. # cat=plugin.tx_extensionname//b; type=boolean; label= Do the cronjob?
  4. 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:

  1. plugin.tx_extensionname {
  2. settings {
  3. loopCount = {$plugin.tx_extensionname.settings.loopCount}
  4. doCronjob = {$plugin.tx_extensionname.settings.doCronjob}
  5. }
  6. }
  7. module.tx_extensionname < plugin.tx_extensionname

Viewing all articles
Browse latest Browse all 310

Trending Articles