View Single Post
Old 04-18-2007, 05:12 AM   PM User | #1
tieone
New to the CF scene

 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
tieone is an unknown quantity at this point
Question RSS Ajax JavaScript ticker

Hello

I have found this nice tutorial on JavaScript Kits.

Now I'm trying to make good use of it but all RSS feeds in this script are stored in an array.

Like this:

PHP Code:
$rsslist=array(
"CNN" => "http://rss.cnn.com/rss/cnn_topstories.rss",
"BBC" => "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",
"news.com" => "http://news.com.com/2547-1_3-0-5.xml",
"slashdot" => "http://rss.slashdot.org/Slashdot/slashdot",
"dynamicdrive" => "http://www.dynamicdrive.com/export.php?type=new"
); 
Than, this extract the feed URLs from the array.

PHP Code:
$rssid=$_GET['id'];
$rssurl=isset($rsslist[$rssid])? $rsslist[$rssid] : die("Error: Can't find requested RSS in list."); 
Can someone teach me how to modify this script, so it fetch RSS feed URLs from a MySQL table/rows instead?

I'm just not sure how to makes this script work with a database.
I knows how to connect to my DB, how to fetch data from it, build my mysql query and my php codes but I'm not sure how to put everything together.

And there is this JS which output the content:
Code:
	<script type="text/javascript">
	//rss_ticker(RSS_id, cachetime, divId, divClass, delay, optionalswitch)
	
	document.write("CNN:")
	new rss_ticker("CNN", 660, "cnnbox", "cnnclass", 10000, "showdescription")
	
	</script>
... can't figure how this will works with the modifications.

I think this very nice script would be more useful for most.

Thanks

Last edited by tieone; 04-18-2007 at 06:10 AM..
tieone is offline   Reply With Quote