Project

General

Profile

Actions

Feature #8963

closed

Input array handling

Added by Mathias Bolt Lesniak over 14 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
TypoScript
Target version:
Start date:
2010-07-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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

Actions

Also available in: Atom PDF