Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End XML/PHP with multiple children

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28584
    dcp3450
    Participant

    I have an xml file of events:

    Code:


    Winter Quarter – 2010

    January
    Firday, January 1
    College Closed: Happy New Year!
    College Closed: Happy New Year! extra
    Monday, January 4
    Winter Quarter Classes Begin
    Late Registration and Drop/Add Begins – Late Fee Applies
    BannerWeb Open
    100% Refund for Any Paid Classes That are Dropped
    Wednesday, January 6
    End 100% Refund Period at 7:00pm
    Tuition and Fee Payment Deadline at 7:00pm
    Thursday – Monday, January 7-11
    Drop/Add Adds allowed only with instructor approval
    No Refund for classes dropped
    Monday, January 11
    Last Day of Drop/Add; Ends at 6:00pm
    Drop/Add Payment Deadline at 6:00pm
    Saturday – Monday January 16-18
    Holiday MLK – Campus Closed


    Using php I want to output all the events under the month:

    Code:
    $xml = simplexml_load_file(“calendar.xml”);

    foreach($xml->quarter->month as $month)
    {
    echo $month->event.’
    ‘;
    }

    I get the first event for each month. i want all the events to print. I’ve looked on php.net and it seems correct. any ideas?

    #73299
    dcp3450
    Participant

    good point about the xml structure.

    and the extrea foreach did the trick. thanks!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.