I want to form file path. In "Constant" field:
const.siteName = site
templates = fileadmin/templates/{$const.siteName}/
When i look in typoscript object browser:
[siteName] = site
[templates] = fileadmin/templates/{$const.siteName}/
Is it possible to achieve this:
[templates] = fileadmin/templates/site/
using const.siteName
?
If yes, how?
=========================================================================
EDIT:
What i am tying to do is next:
In my extension configuration
const.siteName = foo
const.templates = fileadmin/templates/($const.siteName)/
const.path.extensions = ($const.templates)/ext/
I include my extension in typoscript template. In my extension setup i include setup for plugin like this:
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:foo/Configuration/TypoScript/Plugin/formhandler.ts">
In Configuration/TypoScript/Plugin/formhandler.ts:
plugin.Tx_Formhandler {
/* snip */
settings.predef.member {
templateFile.value = {$const.path.extensions}formhandler/member/step-1.html // doesn't work
//templateFile.value = fileadmin/templates/foo/ext/formhandler/member/step-1.html // works
}
/* snip */
}
For me, this example works perfect:
Constants:
const.test = foo
const.test2 = {$const.test}/bar
Setup:
page = PAGE
page.10 = TEXT
page.10.value = {$const.test}
page.10.wrap = <p>|</p>
page.20 = TEXT
page.20.value = {$const.test2}
page.20.wrap = <p>|</p>
Output in Browser:
foo
foo/bar
Tested with TYPO3 4.5 and 8.3
Have a look at the TYPO3 NG/ML/Forum:
https://forum.typo3.org/index.php?t=msg&th=212721&goto=740111&#msg_740111 there are a lot of hints how to use constants in typoscript:
you can reuse constants in constants definition, but only up to 10 levels deep.
you can use constants in conditions, but only in setup-part
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With