Jump to content


Photo

RSS help


  • Please log in to reply
5 replies to this topic

#1 KevinM1

KevinM1
  • Moderators
  • Snarkimus Prime
  • 5,248 posts

Posted 13 October 2006 - 02:56 PM

I have a script that creates an RSS feed for one of the sites I have.  It was working fine, but now it's parsing the info wrong and I'm not sure why.  All it's supposed to do is return a message board post.  Below is the code that creates the link:

<?php //just to turn on the pretty colors

<link>".$base."forum/viewthread.php?".$rstart."forum_id=".$row['forum_id']."&amp;thread_id=".$row['thread_id']."#post_".$row['post_id']."</link>\n

?>

The problem lies at the forum_id - &amp; segment of the code.  Instead of returning something like:
website.com/forum/viewthread.php?rowstart=20forum_id=4&thread_id=25#post_66

I get:
website.com/forum/viewthread.php?rowstart=20=4thread_id=25#post_66

Any ideas on why this is screwing up?  And I haven't changed the code in months, so it's not as though I screwed it up by tweaking it myself.
Using 'global' is a sign of doing it wrong

#2 dymon

dymon
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 13 October 2006 - 03:23 PM

Could you please write what the variable $rstart shows. And why there is no &amp; before "forum_id="?
Web is the future ... desktop will die ...

#3 KevinM1

KevinM1
  • Moderators
  • Snarkimus Prime
  • 5,248 posts

Posted 13 October 2006 - 04:28 PM

The $rstart variable is fine...all it does is specify which table row to start on for pagination.

I put an ampersand before the forum_id, but I'm not sure if it worked yet.  I use Google for reading my feeds, and sometimes it takes a while for any changes to become apparent.
Using 'global' is a sign of doing it wrong

#4 KevinM1

KevinM1
  • Moderators
  • Snarkimus Prime
  • 5,248 posts

Posted 13 October 2006 - 04:53 PM

Should I be using htmlspecialchars_decode for the ampersand?  Or will it print correctly because it's within double-quotes?
Using 'global' is a sign of doing it wrong

#5 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 13 October 2006 - 05:27 PM

Try reading the tutorial Creating dynamic RSS feeds :)
It should help you with creating a dynamic RSS feed.

#6 KevinM1

KevinM1
  • Moderators
  • Snarkimus Prime
  • 5,248 posts

Posted 13 October 2006 - 05:40 PM

I fixed it.  My problem wasn't with creating the feed.  The feed came as part of PHP-Fusion.  The problem came from the pre-existing code using & instead of its HTML entity equivalent whenever the post appeared on any page but the first.  My original tweak (swapping & for its entity), months ago, worked on posts that were on the first page so I thought it would work for all posts, and I didn't notice that $rstart would contain the &.  Oops. :blush:
Using 'global' is a sign of doing it wrong




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users