[Neos] Define variables in Implementation of TypoScript
Arno Dudek
webmaster at adgrafik.at
Tue Mar 17 19:01:36 CET 2015
Hi!
Can I define variables in the @class-Implementation of a TypoScript?
Using this as class definition for TypoScript:
class MyImplementation extends
\TYPO3\TypoScript\TypoScriptObjects\TemplateImplementation {
public function evaluate() {
$myVar = 'hello world!';
$this->properties['myVar'] = $myVar;
// Set TS value with full path.
$this->tsValueCache[$this->path . '/' . 'myVar'] = $myVar;
return parent::evaluate();
}
}
This is the TypoScript:
prototype(Vendor.Package:TSObject) < prototype(TYPO3.Neos:Content) {
@class = 'Vendor\\Package\\TypoScript\\MyImplementation'
templatePath = ...
}
With this setting I can use the defined variable "myVar" in the template
as regular object like
<p>my Variable is: {myVar}</p>
This will work so far.
But now I also want to use "myVar" in the TypoScript itself. I tried
already:
prototype(Vendor.Package:TSObject) < prototype(TYPO3.Neos:Content) {
@class = 'Vendor\\Package\\TypoScript\\MyImplementation'
templatePath = ...
# either this
myVar = ${myVar}
# nor this will work
@override.myVar = ${myVar}
}
Is this possible?
lg arno
More information about the Neos
mailing list