Feature #8963
closedInput array handling
0%
Description
Hi!
I would really love it if stdWrap could handle input arrays too, not just strings. I posted about this on the TYPO3-english list earlier today and got a tip about this project. Here's my post:
Is it really impossible to somehow use array data from GET/POST in TypoScript? I can't seem to find any way to get it to work.
Here's the issue:
URL is: index.php?id=1&test[]=x&test[]=y&test[]=z
How do I access the values of the "test" array without having to do "data = GP : test | 0", "data = GP : test | 1", etc. It won't work if I don't know the length of the array.
I imagine two solutions, but neither exist today. The first one (below) is the easiest, but both require tslib_cobj->getText() to return arrays.
SOLUTION 1:¶
(This doesn't work because "data = GP : test" will return an empty string, since it sees the array.)
page.10 = TEXT page.10.data = GP : test #Implode the array so I can explode it with "split" page.10.implode = , page.10.split { token = , cObjNum = 1 1 = TEXT 1.current = 1 1.wrap = <p>|</p> }
SOLUTION 2:¶
#Using a new cObject which iterates arrays page.10 = ITERATE page.10.data = GP : test page.10.1 = TEXT page.10.1.current = 1 page.10.1.wrap = <p>|</p>
The third solution would be to run everything though a custom USER function, but it's much less flexible.
- Mathias
Updated by Jo Hasenau about 14 years ago
- Status changed from New to Needs Feedback
No implode necessary, because we can directly split the array using new parameters called "mode" and maybe even "arrayKey" and "arrayValue", while still staying backwards compatible and keeping the optionSplit features.
So I would prefer this one:
page.10 = TEXT page.10.data = GP : test page.10.split { mode = array cObjNum = 1|*||*|2 1 = COA 1 { wrap = <p class="first">|</p> 10 = TEXT 10.arrayKey = 1 20 = TEXT 20.arrayValue = 1 } 2 < .1 2 { wrap = <p class="second">|</p> } }
So do you think you can implement that and send a patch?
Anybody else interested in this task?
Have a nice weekend
Joey
Updated by Mathias Bolt Lesniak about 14 years ago
Jo Hasenau wrote:
So do you think you can implement that and send a patch?
I'll take a look. :-)
- Mathias
Updated by Susanne Moog over 13 years ago
- Project changed from 1353 to TYPO3 Core
Updated by Helmut Hummel about 13 years ago
- Priority changed from Should have to Could have
- TYPO3 Version set to 4.7
Updated by Alexander Opitz over 11 years ago
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
Updated by Mathias Bolt Lesniak over 11 years ago
Alexander Opitz wrote:
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
As far as I know it still exists.
I never got that patch sorted out. As far as I can remember, I got stuck in a deliberation about wether not not it was a good idea after all to use split to handle arrays. It seemed counter intuitive.
Updated by Alexander Opitz over 11 years ago
- Status changed from Needs Feedback to New
Updated by Mathias Schreiber almost 10 years ago
- Target version set to 7.2 (Frontend)
- Is Regression set to No
Updated by Mathias Schreiber almost 10 years ago
- Tracker changed from Bug to Feature
Updated by Benni Mack over 9 years ago
- Target version changed from 7.2 (Frontend) to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Benni Mack about 9 years ago
- Target version changed from 7.5 to 8 LTS
Updated by Riccardo De Contardi almost 8 years ago
- Target version changed from 8 LTS to 9.0
Updated by Christian Kuhn almost 7 years ago
- Status changed from New to Closed
closing this for now. if there is specific work on a solution, we should handle that with a new issue.