Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

   

Reply
 
LinkBack Thread Tools Display Modes
Old 01-17-2005, 02:55 PM   #1 (permalink)
DOS
Senior Member
 
DOS's Avatar
 
Join Date: 08-03-04
Posts: 1,077
iTrader: 0 / 0%
Latest Blog:
None

DOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to beholdDOS is a splendid one to behold
News feed code

Do you know of any sites that offer code to paste to your site that will display a box of headlines? I have seen this a couple of times but have not been interested enough to remember what they were.

Specifically, I am looking for political news.
DOS is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-17-2005, 03:01 PM   #2 (permalink)
SVB
Inactive
 
SVB's Avatar
 
Join Date: 10-13-03
Posts: 7,481
iTrader: 0 / 0%
Latest Blog:
None

SVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest orderSVB is a web professional of the highest order
Send a message via Yahoo to SVB
You can use any RSS parser. You then need to find a news feed which has appropriate material, and put its url in the code.

Code:
<html> <head> <title>News</title> </head> <body> <? $xml_file = "http://p.moreover.com/cgi-local/page?c=Videogame%20news&o=xml";//change this to whatever news feed you want to use, at the moment I have it set to video game news $open_tags = array( "ARTICLE" => "<ARTICLE>", "HEADLINE_TEXT" => "<HEADLINE_TEXT>", "URL" => "<URL>", "HARVEST_TIME" => "<HARVEST_TIME>", "SOURCE" => "<SOURCE>"); $close_tags = array( "ARTICLE" => "</ARTICLE>", "HEADLINE_TEXT" => "</HEADLINE_TEXT>", "HARVEST_TIME" => "<HARVEST_TIME>", "URL" => "</URL>", "SOURCE" => "</SOURCE>"); $count=0; function startElement($parser, $name, $attrs=""){ global $open_tags, $temp, $current_tag; $current_tag = $name; if ($format = $open_tags[$name]){ switch($name){ default: break; } } } function endElement($parser, $name, $attrs=""){ global $close_tags, $temp, $current_tag, $count, $numstors; if ($format = $close_tags[$name]){ switch($name){ case "ARTICLE": return_page($temp); $temp = ""; break; default: break; } } } function characterData($parser, $data){ global $current_tag, $temp, $catID; switch($current_tag){ case "HEADLINE_TEXT": $temp["head"] = $data; $current_tag = ""; break; case "URL": $temp["url"] = $data; $current_tag = ""; break; case "SOURCE": $temp["source"] = $data; $current_tag = ""; break; case "HARVEST_TIME": $temp["time"] = $data; $current_tag = ""; break; default: break; } } function return_page(){ global $temp, $count; $temp["time"] = preg_replace ("/AM/", " a.m.", $temp["time"]); $temp["time"] = preg_replace ("/PM/", " p.m.", $temp["time"]); echo "<a href=\"".$temp["url"]."\" target=\"_blank\">".$temp["head"]."</a>\n<br>\n"; echo "[".$temp["source"]."] - ".$temp["time"]."\n<br>\n<br>\n\n"; } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement","endElement"); xml_set_character_data_handler($xml_parser, "characterData"); if (!($fp = fopen($xml_file, "r"))) { die("Could not open $xml_file for parsing!\n"); } while ($data = fread($fp, 4096)) { if (!($data = utf8_encode($data))) { echo "ERROR"."\n"; } if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf( "XML error: %s at line %d\n\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } xml_parser_free($xml_parser); ?> </body> </html>
SVB is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-18-2005, 02:07 AM   #3 (permalink)
Contributing Member
 
funguru's Avatar
 
Join Date: 02-22-04
Location: California
Posts: 1,000
iTrader: 1 / 100%
Latest Blog:
The Web 2.0 Look!

funguru is just really nicefunguru is just really nicefunguru is just really nicefunguru is just really nicefunguru is just really nicefunguru is just really nicefunguru is just really nicefunguru is just really nice
http://w.moreover.com/main_site/content/publishers.html
__________________
Add Link Directory $2 Submissions | SpeedHost.in Web Hosting India
funguru is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-18-2005, 06:16 AM   #4 (permalink)
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 9,354
iTrader: 0 / 0%
Latest Blog:
None

Jazzee is liked by somebodyJazzee is liked by somebodyJazzee is liked by somebodyJazzee is liked by somebodyJazzee is liked by somebody
*Moved to coding forum.
Jazzee is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-18-2005, 12:44 PM   #5 (permalink)
Contributing Member
 
Join Date: 05-02-04
Posts: 142
iTrader: 0 / 0%
Latest Blog:
None

notepage is just really nicenotepage is just really nicenotepage is just really nicenotepage is just really nicenotepage is just really nicenotepage is just really nicenotepage is just really nicenotepage is just really nice
displaying RSS

Quote:
Originally Posted by DOS
Do you know of any sites that offer code to paste to your site that will display a box of headlines? I have seen this a couple of times but have not been interested enough to remember what they were.
There are a few different ways to display news headlines, you can use javascript see http://www.feedroll.com the downside to using javascript is that contents of the feed will not be able to be spidered by search engines.

You can also use PHP or ASP to display a feeds contents. We just posted a free PHP script to display RSS at http://www.feedforall.com/free-php-script.htm

As far as finding feeds there are a number of RSS directories try those listed at http://www.rss-specifications.com/rss-submission.htm

HTH
Sharon Housley
FeedForAll - http://www.feedforall.com
NotePage, Inc. - http://www.notepage.net
notepage is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I block Feed Scrapers from stealing my blog feed? kagemusha Blogging Forum 0 03-27-2007 11:57 AM
Best way to create a news feed for our site?? chrisnrach17 Web Design Lobby 7 05-15-2006 05:02 AM
News feed idea - Need your opinion of the concept jam937 Marketing Forum 4 02-01-2006 06:19 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 03:01 AM.
© Copyright 2008 V7 Inc