|
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I emailed info@universetoday.com but I didnt recive a reply and its been over 2 days. I just thought I would register to the forums and ask some questions. My emailed is quoted below, as I didnt want to take my time typing it out again. *I wasnt sure if Universe Today was admined by a single person or a group of members.
Quote:
![]() I think this would give us PHP people benfits. |
|
||||
|
Hi Karan, the stories in Universe Today are available as an RSS feed.
http://www.universetoday.com/universetoday.xml So you can format that data into your website in any way you like. I'm not sure about the images, though. Right now there are 1000s of websites currently depending on me to not change any part of the Javascript file. So, I'm going to hold off changing the way I syndicate things. I appreciate your suggestions, though.
__________________
Fraser Cain Publisher Universe Today - Free space news delivered by email every weekday. |
|
|||
|
Yes I understand that a lot of people are using the Javascript. It was worth a try. Can I see any examples of how it looks when its customized with the RSS. I never got the chance to see how RSS exactly works. Can you explain it to me please.
|
|
||||
|
RSS is an incarnation of xml, which is a format very easily read by computers- similar to html in structure in that you have an opening tag, some data, then a closing tag. PHP has built in functions to parse an xml document such as an rss feed, enabling you to extract and display the information in any way you please.
Basically (unless you have php 5) to get php to parse a xml document you define 3 functions, what to do when php finds an opening tag, what to do when it finds some data between tags, and what to do when it finds a closing tag. In your case you want something like: Code:
if($name=="LINK") {
echo "<a href='".$data."'>Click here for the full UT story</a>";
} else if($name=="TITLE") {
echo "<h2>".$data."</h2>";
} else if($name=="DESCRIPTION") {
echo "<p>".$data."</p>";
}
http://www.astronomyforbeginners.com/astro.../news.php?js=no I can post or send you the php code if you like. (Although note that the rss feed on UT does not contain urls for the images, so you can't show images for the stories) |
|
|||
|
yes please could you post the code for me. I really wanted the images but what can you do
btw why cant you have them? *new to php and all the rest but html* btw the news looks really cool on your website. if your allowed to upload a file could you do that please or send it to karansokhey@gmail.comthank you |
|
|||
|
Cool thanks a lot. It works. I was just wondering if I only wanted to show 3 or 4 stories. How would that be done? I've already tried
Code:
$ut = rss_feed("http://www.universetoday.com/universetoday.xml","1,2,3");
echo $ut;
Code:
$ut = rss_feed("http://www.universetoday.com/universetoday.xml","1","2","3");
echo $ut;
Code:
$ut = rss_feed("http://www.universetoday.com/universetoday.xml","1");
echo $ut;
$ut = rss_feed("http://www.universetoday.com/universetoday.xml","2");
echo $ut;
$ut = rss_feed("http://www.universetoday.com/universetoday.xml","3");
echo $ut;
Code:
$ut = rss_feed("http://www.universetoday.com/universetoday.xml","3");
echo $ut;
|
|
|||
|
oh almost forgot to request something from fraser. do you think you could add images to the rss feed? it makes it so much more interesting. Right now it just looks like plain text that wouldnt mean anything to the audiance such as kids.
|