1, December 2008

on-the-fly RSS - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: on-the-fly RSS
« previous next »
Pages: [1] Print

Author Topic: on-the-fly RSS  (Read 685 times)
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« on: Apr 18, 2007, 07:52:10 PM »

apparently there is a problem now with my RSS file, as i coded the file myself to create itself from news in the database as im sure most of you have.. but what is the problem?

here is the file itself: http://jlove.justinlove.net/rss.php Visit through proxy

Code:
<?php
$conn 
mysql_connect("DATAHIDDEN","DATAHIDDEN","DATAHIDDEN");
mysql_select_db("DATAHIDDEN") or die(mysql_error());
function 
bbdecode($text) {
$text str_replace('[b]'''$text);
$text str_replace('[/b]'''$text);
$text str_replace('[i]'''$text);
$text str_replace('[/i]'''$text);
$text str_replace('[u]'''$text);
$text str_replace('[/u]'''$text);
$text str_replace('[url]'''$text);
$text str_replace('[/url]'''$text);
$text str_replace('[img]'''$text);
$text str_replace('[/img]'''$text);
$text str_replace('[center]'''$text);
$text str_replace('[/center]'''$text);
$text str_replace('[small]'''$text);
$text str_replace('[/small]'''$text);
$text str_replace('[big]'''$text);
$text str_replace('[/big]'''$text);
return $text;
}
function 
showdate($format$val) {
return strftime($format$val+(1*3600));
}

$result mysql_query("SELECT * FROM haze_news ORDER BY postdate DESC");
header("content-type:text/xml;charset=utf-8");

echo 
"<rss version='2.0'>\n";
echo 
"<channel>\n";
echo 
"<title>J Love's Blog RSS Feed</title>\n";
echo 
"<link>http://jlove.justinlove.net/</link>\n";
echo 
"<description>Justin Love's Personal Site - Blog : RSS Feed</description>\n";
while(
$row mysql_fetch_array($result)) {
$news_cat mysql_fetch_array(mysql_query("SELECT news_cat_id, news_cat_title FROM haze_news_cats WHERE news_cat_id = ".$row['news_cat_id']));
$cat_name stripslashes($news_cat['news_cat_title']);
$cat_id $news_cat['news_cat_id'];
echo "<item>\n";
echo "<title>".stripslashes($row['title'])."</title>\n";
echo "<link>http://jlove.justinlove.net/page.php?id=8&amp;view=news&amp;news_id=".$row['id']."</link>\n";
echo "<description>".bbdecode($row['content'])."</description>\n";
echo "<guid isPermaLink='true'>http://jlove.justinlove.net/page.php?id=8&amp;view=news&amp;news_id=".$row['id']."</guid>\n";
echo "<category domain='http://jlove.justinlove.net/page.php?id=12&amp;cat_id=".$cat_id."'>".$cat_name."</category>\n";
echo "<pubDate>".showdate("%a, %d %b %G %H:%M:%S EST"$row['postdate'])."</pubDate>\n";
echo "</item>\n";
}
echo 
"</channel>\n";
echo 
"</rss>\n";
?>

this is of course the same feed i am still trying to submit to my profile on webdigity =/

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« Reply #1 on: Apr 18, 2007, 08:08:55 PM »

nevermind.. have found the problem, has alot to do with single quotes and ampersands, here is how i solved the problem if anyone needs help with those rss self creating files:

Code:
<?php

<?php
$conn 
mysql_connect("datahidden","datahidden","datahidden");
mysql_select_db("datahidden") or die(mysql_error());
define("QUOTES_GPC", (ini_get('magic_quotes_gpc') ? TRUE FALSE));

function 
bbdecode($text) {
$text str_replace('[b]'''$text);
$text str_replace('[/b]'''$text);
$text str_replace('[i]'''$text);
$text str_replace('[/i]'''$text);
$text str_replace('[u]'''$text);
$text str_replace('[/u]'''$text);
$text str_replace('[url]'''$text);
$text str_replace('[/url]'''$text);
$text str_replace('[img]'''$text);
$text str_replace('[/img]'''$text);
$text str_replace('[center]'''$text);
$text str_replace('[/center]'''$text);
$text str_replace('[small]'''$text);
$text str_replace('[/small]'''$text);
$text str_replace('[big]'''$text);
$text str_replace('[/big]'''$text);
return $text;
}
function 
showdate($format$val) {
return strftime($format$val+(1*3600));
}
function 
phpentities($text) {
$search = array("&""\"""'""\\""<"">");
$replace = array("&amp;""&quot;""&apos;""&#92;""&lt;""&gt;");
$text str_replace($search$replace$text);
return $text;
}
function 
stripinput($text) {
if (QUOTES_GPC$text stripslashes($text);
$search = array("\"""'""\\"'\"'"\'""<"">""&nbsp;");
$replace = array("&quot;""&#39;""&#92;""&quot;""&#39;""&lt;""&gt;"" ");
$text str_replace($search$replace$text);
return $text;
}

$result mysql_query("SELECT * FROM haze_news ORDER BY postdate DESC");
header("content-type:text/xml;charset=utf-8");

echo 
"<rss version='2.0'>\n";
echo 
"<channel>\n";
echo 
"<title>J Love's Blog RSS Feed</title>\n";
echo 
"<link>http://jlove.justinlove.net/</link>\n";
echo 
"<description>Justin Love's Personal Site - Blog : RSS Feed</description>\n";
while(
$row mysql_fetch_array($result)) {
$news_cat mysql_fetch_array(mysql_query("SELECT news_cat_id, news_cat_title FROM haze_news_cats WHERE news_cat_id = ".$row['news_cat_id']));
$cat_name stripslashes($news_cat['news_cat_title']);
$cat_id $news_cat['news_cat_id'];
echo "<item>\n";
echo "<title>".str_replace(" & "" &amp; "stripinput($row['title']))."</title>\n";
//echo "<title>".str_replace(" & ", " &amp; ", stripslashes($row['title']))."</title>\n";
echo "<link>http://jlove.justinlove.net/page.php?id=8&amp;view=news&amp;news_id=".$row['id']."</link>\n";
echo "<description>".phpentities(bbdecode($row['content']))."</description>\n";
echo "<guid isPermaLink='true'>http://jlove.justinlove.net/page.php?id=8&amp;view=news&amp;news_id=".$row['id']."</guid>\n";
echo "<category domain='http://jlove.justinlove.net/page.php?id=12&amp;cat_id=".$cat_id."'>".$cat_name."</category>\n";
echo "<pubDate>".showdate("%a, %d %b %G %H:%M:%S EST"$row['postdate'])."</pubDate>\n";
echo "</item>\n";
}
echo 
"</channel>\n";
echo 
"</rss>\n";
?>

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #2 on: Apr 18, 2007, 09:00:33 PM »

Looks like you are going better with php Method.

Bravo! Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« Reply #3 on: Apr 19, 2007, 12:30:43 AM »

thanks Nik, i  have learned most of it from you and Wineo working in private, as well as closely studying the syntax of fusion and other popular CMS software .. i owe many thanks and credit to Webdigity! greatest web community i have yet to come across

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #4 on: Apr 19, 2007, 01:10:38 PM »

thanks Nik, i  have learned most of it from you and Wineo working in private, as well as closely studying the syntax of fusion and other popular CMS software .. i owe many thanks and credit to Webdigity! greatest web community i have yet to come across

Nice to hear that. And that's how the open source community works.

Because before I helped you, someone helped me who got help from another guy, etc. etc etc Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6406
Tags : rss Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: on-the-fly RSS
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 01, 2008, 09:06:52 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.937
Total Topics: 7.679
Total Members: 4.443
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: mayabiotech

26 Guests, 5 Users online :

12 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.