Freeplayzone Posted December 16, 2006 Share Posted December 16, 2006 I'm trying to make a php script that reads then displays jokes on my web page.here is a sample of what i'm trying to read[code]<?xml version="1.0" encoding="utf-8"?><rss version="2.0"> <channel> <joketitle>Poof Goes the Light</joketitle> <link>http://www.freeplayzone.com</link> <joke>An 80-year-old man goes for a physical. All of his tests come back with normal results. The doctor says, "George, everything looks great. How are you doing mentally and emotionally? Are you at peace with God?" George replies, "God and I are tight. He knows I have poor eyesight, so he's fixed it so when I get up in the middle of the night to go to the bathroom; poof.... the light goes on. When I'm done, poof....the light goes off." "Wow, that's incredible," the doctor says.A little later in the day, the doctor calls George's wife. "Ethel," he says, "George is doing fine! But I had to call you because I'm in awe of his relationship with God. Is it true that he gets up during the night and poof.... the light goes on in the bathroom, and when he's done, poof....the light goes off?""Oh my God!" Ethel exclaims. "He's peeing in the refrigerator again!"</Joke> </channel></rss>[/code]can anyone please give me a suggestion on how best to start my script so i can see if i'm trying to retrive my info right. Quote Link to comment Share on other sites More sharing options...
taith Posted December 16, 2006 Share Posted December 16, 2006 [code]<?$jokes[]='write joke here';$jokes[]='write joke here';$jokes[]='write joke here';echo $jokes[rand(0,count($jokes))];?>[/code] Quote Link to comment Share on other sites More sharing options...
Freeplayzone Posted December 16, 2006 Author Share Posted December 16, 2006 Thanks I i think thats what I've been looking for.But if anyone else has any other suggesion please reply to this post as well Quote Link to comment Share on other sites More sharing options...
alpine Posted December 16, 2006 Share Posted December 16, 2006 I think you are looking to parse remote xml files, not write them in arrays ?Post what you have (code) or start in the manual: http://no.php.net/xml_parseThere is some examples there too. Quote Link to comment Share on other sites More sharing options...
Freeplayzone Posted December 16, 2006 Author Share Posted December 16, 2006 I don't realy have any code for my php file yet i just started it and wanted to know if it was the right way to go about what i was trying to do.so here what i'm trying to do- first I want to retreve my joke from a file like an rss feed- second I want to randomly pick one joke to display- third i want to display it on my webpage Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.