1
votes

I've tried several approaches to read the configuration options of my plugin in typoscript, but none of them seem to work

    ajax.30 = TEXT
    ajax.30.value =   {plugin.tx_parser.settings.numVar}
    ajax.40 < {tx_parser.settings.numVar}
    ajax.50 < {tx_parser.settings.numVar}
    ajax.80 = TEXT
    ajax.80.value = {options.numVar}
    ajax.90 = TEXT
    ajax.90.value = {settings.numVar}

Can anyone please explain me the syntax or post a link where it is explained; I can use ext_conf_template.txt explained here https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/ConfigurationOptions/Index.html but I didn't get these options in typoscript.

typoscript object browser

All I want is to access (in typoscript) the configuration options of the following picture

the needed extension configuration options

If I browse Constants I don't see any of these options

the constants browser

If I add my plugin to the site I see some plugin options but none of them I wanted

enter image description here

1
Configuration added to the Extension configuration are not the same thing as TypoScript constants. And if you add an Extension Configuration option it will not be added to TypoScript as a constant. --- All constants have to be defined in your template record either in the constants field, or by using static files and include them in your template record. - Nitori

1 Answers

1
votes

You can use constants with this syntax in TypoScript setup or constants

var = {$plugin.tx_parser.settings.numVar}

So in your case:

ajax.30 = TEXT
ajax.30.value = {$plugin.tx_parser.settings.numVar}

See https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/UsingSetting/Constants.html

To assign an earlier declared setup value you would use the < (object copy) operator

ajax.30 = TEXT
ajax.30.value < plugin.tx_parser.settings.numVar

Here is an on overview of its syntax: https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/TypoScriptSyntax/Syntax/TypoScriptSyntax.html

The difference between constants and setup is essential. You can check in the backend in the module Template -> Template browser - see https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/UsingSetting/Debugging.html