Php + Xml

lieb39

Apple lover, PC User
Joined
27 Nov 2002
Messages
526
Hello everyone,

I am wondering how this can be done; basically I want to list all my .xml files in a certain folder on my website, and than if the user clicks on one it will open in a template, that formats the data. I heard that PHP can do this but after 15 minutes of reading a very newbie guide to PHP I gave up. Has anyone ever created a source code for this that free, or is anyone willing to help me?

Thanks,

lieb39
 
Listing the files is easy enough, see this thread over at X-istence.com

You'd probably have to change
PHP:
print "<li><a href=\"$file\" title=\"$file - $filesize KB\">
to something like
PHP:
print "<li><a href=\"parse.php?file=$file\" title=\"$file - $filesize KB\">
where-by parse.php is the file which parses the XML file that is passed to it via the $_GET[file] variable.

How exactly do you want the data from the XML to be formatted?
 
Originally posted by SPeedY_B
How exactly do you want the data from the XML to be formatted?

Well in my XML file I will have <Date>, <Mood>, <Title> and than my actual text, which will be <Text>. I just basically want this to look nice, each one on a different line, like this;
Title:[Title, in bold, bigger than the other fonts if possible]
Date: [Date displayed here]
Mood: [Mood]
Text: [Text here, wrapped to fit the screen of course]

Thats how... And Thank you very much for answering the first part of my question:)


-lieb39
 
Ok, Give me a minute, just need to test the code and so on :)
 
Alright, forget about all my last posts. This is what I have now;
A page to list my XML files (http://www.centralogn.com/~dan/aussie/journal/)
A typical XML file I will write (http://www.centralogn.com/~dan/aussie/journal/j1.xml)
[In case you are wondering, my website is here, http://www.centralogn.com/~dan/aussie/'

All I need now is a website or whatever, so that when a xml file is clicked on from my page that lists them, it will be passed through a file or whatever to format it. anyone at all?

Edit, I also need the background to be colour #D9E2E7 , this is very important.

Edit, Edit: I trying the "print_"<li><a_href=\"$file\"_title=\"$file_-_$filesize_KB\">" but I couldn't find it in my document.

-lieb39
 
the rss url is your xml file.
to have them displayed when you click a link would require another php page.


I couldn't get my XML to parse last night, kept feeding me damned errors *slap* but I'll try again later. Does it have to be xml? it would be so much easier with a plain text file and the file(); function..
 
hmm.. well i guess i could drop for a .txt file... how would the .txt file itself be formatted?

-lieb39
 
A typical Journal
Sept 7 2003
Okay
this is where my text goes...
A typical Journal 2
Sept 8 2003
Okay again
this is where more text goes...

or

A typical Journal||Sept 7 2003||Okay||this is where my text goes...
A typical Journal 2||Sept 8 2003||Okay again||this is where more text goes...
 
hmm okay, i would go for the break between each line;
A typical Journal
Sept 7 2003
Okay
this is where my text goes...

but keep in mind that i have seperate .txt or whatever files for each journal. it will be in .txt files?

-lieb39
 
Okay, I'm off to bed.. Its too late.. its 12:03am and i have school tomorrow... i will put everything together thats posted here tomorrow...

-lieb39
 
File attached. There's a readme file within, and some demo/example text's included. So you can try it out before-hand in a test folder or something :)

Hmm, It's 4am, perhaps I should sleep.
 
All hail Speedy_b!!! He is proclaimed god by lieb39!
/me owes speedy_b

-lieb39
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back