Joseph Witchard
06-13-2009, 02:08 AM
I built it with PHP, but the problem seems to be XML related. That's why I'm posting it here. This is my first attempt at an RSS feed, so go easy on me. I was able to bookmark the feed in Firefox, but when you go to the bookmark, it says "Live bookmark feed failed to load."
<?php
/** Coded by: Jeffrey (Joseph Witchard)
** Created on: 06/13/09
** Last modified: 06/13/09
** Purpose: To syndicate Rebirth news
** via RSS. */
// configure to XML
header("Content-Type: application/xml; charset=utf-8");
// include the connection setting
require('path_to_connection');
// set up the connection
$conn = access_function();
// set up the query
$query = "SELECT post_id, author_name, DATE_FORMAT(date_posted, '%W, %M %d, %Y %l:%i %p') AS formatted_date, author_email, description, a.category_id, c.category_name, title FROM posts a INNER JOIN categories c ON a.category_id = c.category_id ORDER BY post_id LIMIT 10";
// start pulling out the data
if ($stmt = $conn->prepare($query))
{
$stmt->execute();
$stmt->bind_result($postID, $author, $date, $email, $post_desc, $cat_id, $cat_name, $post_title);
echo '<?xml version="1.0"?>';
echo '<rss version="2.0">';
echo "<channel>";
while ($stmt->fecth())
{
echo "<item>";
echo "<title>$post_title</title";
echo "<link>http://www.uhrebirth.com/show_news/$postID</link>";
echo "<description>$post_desc</description>";
echo "<pubDate>$date</pubDate>";
echo "<author>$author</author>";
echo "<managingEditor>$email</managingEditor>";
echo "<webMaster>josephwitchard@uhrebirth.com</webMaster>";
echo "<category>$cat_name</category>";
echo "</item>";
}
echo "</channel>";
echo "</rss>";
echo "</xml>";
}
?>
<?php
/** Coded by: Jeffrey (Joseph Witchard)
** Created on: 06/13/09
** Last modified: 06/13/09
** Purpose: To syndicate Rebirth news
** via RSS. */
// configure to XML
header("Content-Type: application/xml; charset=utf-8");
// include the connection setting
require('path_to_connection');
// set up the connection
$conn = access_function();
// set up the query
$query = "SELECT post_id, author_name, DATE_FORMAT(date_posted, '%W, %M %d, %Y %l:%i %p') AS formatted_date, author_email, description, a.category_id, c.category_name, title FROM posts a INNER JOIN categories c ON a.category_id = c.category_id ORDER BY post_id LIMIT 10";
// start pulling out the data
if ($stmt = $conn->prepare($query))
{
$stmt->execute();
$stmt->bind_result($postID, $author, $date, $email, $post_desc, $cat_id, $cat_name, $post_title);
echo '<?xml version="1.0"?>';
echo '<rss version="2.0">';
echo "<channel>";
while ($stmt->fecth())
{
echo "<item>";
echo "<title>$post_title</title";
echo "<link>http://www.uhrebirth.com/show_news/$postID</link>";
echo "<description>$post_desc</description>";
echo "<pubDate>$date</pubDate>";
echo "<author>$author</author>";
echo "<managingEditor>$email</managingEditor>";
echo "<webMaster>josephwitchard@uhrebirth.com</webMaster>";
echo "<category>$cat_name</category>";
echo "</item>";
}
echo "</channel>";
echo "</rss>";
echo "</xml>";
}
?>