Challenging Arrays

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Perih

    #1

    Challenging Arrays

    Hi ya'll;

    Consider this array:

    $xmlData = array (
    'slideshow' =array ('settings' =array ( 'image_folder' =>
    'ads/', 'time' ='1', 'fade' ='2', 'repeat' ='true', 'captions'
    ='false',),
    'images' =array ('image' =array (
    0 = array ('file' ='1.jpg', 'caption' ='Series #1',),
    1 = array ('file' ='2.jpg', 'caption' ='Series #2',),
    2 = array ('file' ='3.jpg', 'caption' ='Series #3',),
    ),
    ),
    ),
    );

    I've chosen *not* to use SimpleXML for xml processing -- our webhost
    won't upgrade his php beyond some early 5.x build, and not all
    SimpleXML functions are in there (like, addChild()). So, I'm using a
    different library.

    Anyway, basically, what my question is that, how can I write one
    "settings" array as it is, and then add new [files][file] arrays to
    the structure, but the number of those will vary (based on previous
    pages' dynamically-generated <formcode as

    <input type="text" name="file[]"</input>
    <input type="text" name="file[]"</input>
    <input type="text" name="file[]"</input>
    ... (could be dozens)

    I can get the values, of course... how how to I add the array
    structure to the above array programatically ?

Working...