Help with UDT tag - XML parsing

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Joseph777
Forum Members
Forum Members
Posts: 206
Joined: Wed Mar 16, 2011 9:13 am

Help with UDT tag - XML parsing

Post 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);
mcDavid
Power Poster
Power Poster
Posts: 377
Joined: Tue Mar 31, 2009 8:45 pm

Re: Help with UDT tag - XML parsing

Post 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.
Post Reply

Return to “The Lounge”