[Typo3-dev] Numeric indexes in XML

Martin T. Kutschker Martin.no5pam.Kutschker at blackbox.n0spam.net
Fri Sep 24 09:24:33 CEST 2004


John Begley wrote:
> I am trying to configure a TCEForm of type "radio" in flexform xml.  I know
> "items" needs to be passed an array of 2-element arrays (key and value) but
> how do I do this in XML when the 2 elements will have keys "0 "and "1" ?
> 
> I know there has been discussion on this and I have read the thread
> "suggestion for t3lib_div::xml2array()" carefully (23rd March)
> Unfortunately I'm still confused.  Is there a simple explaination, or is
> there some documentation I have missed?

AFAIR there is the attribute "index". If the value of index is numeric 
the resulting php array will be numeric entry, if not it will be a hash 
entry.

So this

<elements>
  <element index="a">III</element>
  <element index="b">IV</element>
  <element index="0">I</element>
  <element index="1">II</element>
</elements>

will become this

array( 'I', 'II', 'a'=>'III', 'b'=>IV');

Masi




More information about the TYPO3-dev mailing list