<?php $dom = new DOMDocument() ; include "connection.php"; $queryz = "SELECT * FROM ticker"; $resultz = mysql_query($queryz) or die('Error, query failed'); $row = mysql_fetch_assoc($resultz); $rss = $dom->createElement('rss'); while($row = mysql_fetch_array( $resultz )) { $item = $dom->createElement("item"); $item->appendChild($dom->createElement("title", $row['item_title'])); $item->appendChild($dom->createElement("pubDate",$row['item_pubDate'])); $item->appendChild($dom->createElement("description",$row['item_description'])); $item->appendChild($dom->createElement("link",$row['item_link'])); $rss->appendChild($item); } $dom->appendChild($rss); $dom->save("myxml.xml");
OR
<?php header('Content-Type: text/xml; charset=UTF-8'); $dom = new DOMDocument() ; include "connection.php"; $queryz = "SELECT * FROM ticker"; $resultz = mysql_query($queryz) or die('Error, query failed'); $row = mysql_fetch_assoc($resultz); while($row = mysql_fetch_array( $resultz )) { $tit = $dom->createElement("title", $row['item_title']) ; $pub = $dom->createElement("pubDate",$row['item_pubDate']) ; $des = $dom->createElement("description",$row['item_description']) ; $lnk = $dom->createElement("link",$row['item_link']) ; $dom->appendChild($tit) ; $dom->appendChild($pub) ; $dom->appendChild($des) ; $dom->appendChild($lnk) ; } $dom->save("myxml.xml") ; ?>
RSS Display
<?php include('rss-feed-reader.php'); $feed = 'http://www.domain.com/feed.xml'; $max_items = 5; $rss = new mod_rss(); $rss->parser($feed, $max_items, true); ?>
Comments
Post a Comment
Thanks
Warm regards,
Karthikeyan.T
tkarthikeyan@gmail.com
www.carthworks.com
Call us 09445 2772 06