How can I write this old style typoscript condition in Symfony Expression language?
[globalVar = GP:tx_myext_myplugin|bla > 0]
Perhaps something like
[request.getQueryParams()['tx_myext_myplugin[bla]'] > 0]
but that is obvious not working.
[(request.getQueryParams()['tx_myext_myplugin'])['bla'] > 0]
In case it is generating an error inside log then you need to check like this.. (ie Unable to get an item on a non-array)
[request.getQueryParams() and
request.getQueryParams()['tx_myext_myplugin'] and
request.getQueryParams()['tx_myext_myplugin']['bla'] > 0]
//Typoscript Code
[end]
&& can also be used as conditional operator here
The old style TypoScript condition [globalVar = GP:tx_myext_myplugin|bla > 0]
can be written with new condition syntax like [traverse(request.getQueryParams(), 'tx_myext_myplugin/bla') > 0]
.
Use traverse
in combination with getQueryParams
to avoid errors in case a key in the parameter array is not defined .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.