• Welcome to Computer Association of SIUE - Forums.
 

Headlines

Started by Guest, 2004-03-09T11:16:26-06:00 (Tuesday)

Previous topic - Next topic

Guest

Just curious, but how do the headlines on the homepage get updated? Is it done dynamicly or does some one actually update them daily?

If it is done dynamically, how is this accomplished? I would like to add Google's news to my website, but I have no idea on how to go about accomplishing this task. Any and all help would be appreciated.

Stiffler

The PHP code stores the headlines in a cache for a set period of time. I think it's set to 5 hours, unless that number was changed. Everytime time someone visits the CAOS Start page or the headlines module page a script is run. This script looks at the time that the headlines were put in the cache and compares that to the current time. If the difference between times is less than 5 hours, the headlines from the cache are loaded, but if the difference is greater than 5 hours, the headlines are updated and stored to the cache. The cache is a bunch of php code that was compiled to HTML so it loads a lot faster. That script may seem like it'd take a long time to load, but it doesn't, unless the server that the rss feed is slow (see previous post about the slowness).

Hope I explained this well. I may edit this post later if I find a better way to say it.

Jon
Retired webmaster of CAOS.

Guest

I understand that part, but how do the headlines get in the cache? Does the script search a page that is specified in the script or does someone manually place them there?

Here is what I would like to do, maybe this will help explain what I am asking. I would like to set up a News section on my website. Instead of updating the news every day manually, I would like to have a script of some sort scan Google News and place those headlines in my news section. I know this is possible, I seen it somewhere on a page that said news provided by Google. I just don't remember where I seen it at. If it is possible to accomplish this with a script, do you know where I could find some insight on the subject?

Thanks for the help though.

Peter Motyka

The PHP module fetches a XML RSS feed from each website.  Last time I checked, Google News was not offering RSS feeds.  However, I believe someone wrote a parser for the Google News site that parses the page regions and generates an XML RSS feed.  I would be careful using that though, if Google changes the page layout, I imagine the third-party parser would break.

Example, here is slashdot.org's RSS feed:
http://slashdot.org/index.rss
SIUE CS Alumni 2002
Grad Student, Regis University
Senior Engineer, Ping Identity
http://motyka.org

Peter Motyka

Google news RSS,

http://googlenews.74d.com/

Problems with Google News RSS Feeds?
The script used to create these RSS feeds automatically parse the HTML on the Google News web site. It is possible that the script may break if Google changes the layout of its web site. If feeds are not updating, appear blank, or there is any other weirdness, email googlenews@74d.com to let me know.
SIUE CS Alumni 2002
Grad Student, Regis University
Senior Engineer, Ping Identity
http://motyka.org

Guest

Cool thanks alot man. I will check that out. Thanks again for all the help.