I want viewhelper that can be helpful to assign variable in fluid, I dont want variable to be passed from controller.
Install extension called vhs from TYPO3 repository
Define namespace like following at the top of your fluid template
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
Then use set viewhelper
<v:variable.set name="test" value="12345" />
Value of test : {test}
{test} will return value 12345
For registering global variable
<v:variable.register.set name="test" value="12345"/>]
Get value of global variable
Value of global variable : <v:variable.register.get name="test">
Since TYPO3 8.7, fluid introduces viewhelper for the variable (No need of VHS)
<f:variable name="myvariable">My variable's content</f:variable>
<f:variable name="myvariable" value="My variable's content"/>
With inline style usage
{f:variable(name: 'myvariable', value: 'My variable\'s content')}
{myoriginalvariable -> f:variable.set(name: 'mynewvariable')}
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