Page 1 of 1

Help with UDT tag - XML parsing

Posted: Sat Sep 22, 2012 12:01 pm
by Joseph777
How do i display XML feed (see bellow) on my website?

Code: Select all

<Diary>
<Event EventName="Lorient v Nice" ClassificationID="1" Classification="Soccer" EventStart="2012-09-22T19:00:00+01:00" EventEnd="2012-09-22T19:00:00+01:00" Streaming="1" BlockedCountryCodes="AE#BH#DZ#EG#FR#IL#IQ#IR#JO#JP#KW#LB#LY#MA#OM#QA#SA#SD#SU#SY#TN#US#YE#" EventGroup="France Le Championnat"/>
</Diary>
here is whole XML
https://docs.google.com/open?id=0B699zw ... 3ZKbUhOTEU

I created UDT tag (see bellow), but I do not know how to continue.

Code: Select all

$timeout = 3600*24;
$remote_files = new cge_cached_remote_file('http://www.domain.tld/diary.xml', $timeout);
$xml = $remote_files->file_get_contents();
$json = json_encode($xml);
$array = json_decode($json,TRUE);
print_R($array);

Re: Help with UDT tag - XML parsing

Posted: Mon Sep 24, 2012 11:34 am
by mcDavid
Why don't you use simpleXML?
http://php.net/manual/en/function.simpl ... d-file.php

I think the easiest way to procede is to return the object as a smarty variable and make a smarty template to display the contents.