[TYPO3-dev] CONTENT: add support for virtual table

Jigal van Hemert jigal at xs4all.nl
Thu Oct 21 19:16:52 CEST 2010


On 21-10-2010 15:41, Steffen Kamper wrote:
> i discussed array handling in TS with Joey as it was also a request from
> our talk at T3Con10.
> One big problem is that TS has it's own syntax with arrays (property.)
> which makes it really hard to parse, though array handling in php is
> very easy.
> We didn't found a good idea how to realize, maybe you have an idea?

There are some things which are already working in other areas and some 
features which would be handy. The challenge is to combine these somehow :-)

One thing I have encountered a few times is that I'd like to pass an 
array in a "field" of a "row" which can be processed by stdWrap. Say you 
have an fe_user record and you add a list of certain groups to that 
record which should include the group ID and group name. In TS you could 
display that as a list of links.

There is already a mechanism to loop through a list of db records 
(CONTENT object) and process each item with the renderObj.

Another thing you'd might want to do is to set up an array with 
key-value pairs (possibly nested) inside TS and process it later.
TypoScript is in the form of an array, whith the complexity of having 
direct values (key: "property") and sub-arrays (key: "property.").
This could be solved by creating a new 'object' for the sub-arrays (a 
bit like the COA)

lib.plaap = ASSOCIATIVE_ARRAY
lib.plaap {
   10 = ASAR #short for ASSOCIATIVE_ARRAY and not a normal word
   10 {
     uid = 20
     title = First group
   }
   20 = ASAR
   20 {
     uid = 30
     title = Second group
   }
}

Items are normally accessible by using:
plaap.10.title

For iterating the array we could use a FOREACH object:

10 = FOREACH
10 {
   source < lib.plaap
or
   source.field = db_field_name

   renderObj = TEXT
   renderObj {
     field = title
     typolink {
       parameter = 73
       additionalParams.dataWrap = &tx_myext_pi1[showUid]={field:uid}
     }
   }
}

Just some thoughts...

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh




More information about the TYPO3-dev mailing list