Open and randomize an existing xml file with php??

Discussion in 'PHP' started by 123GoToAndPlay, May 6, 2008.

  1. #1
    Hi,

    I need to randomize xml nodes for the use in flash. The existing file is quit simple

    
    <icons>
    <icon image="imgs/flash/1.jpg"link="http://www.domain1.com/"/>
    <icon image="imgs/flash/2.jpg"link="http://www.domain2.com/"/>
    <icon image="imgs/flash/3.jpg"link="http://www.domain3.com/"/>
    <icon image="imgs/flash/4.jpg"link="http://www.domain4com/"/>
    etc.
    </icons>
    
    Code (markup):
    now i want to have something lik icons.php which open/reads icons.xml and randomize the icons order.

    any tips?
     
    123GoToAndPlay, May 6, 2008 IP
  2. kreoton

    kreoton Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can parse xml to array then shuffle it and make xml document again :)
     
    kreoton, May 6, 2008 IP
  3. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    @kreoton, thx

    I was thinking about doing it that but i have done the randomize part in flash (with a shuffle function).
     
    123GoToAndPlay, May 7, 2008 IP