Jump to content

Archived

This topic is now archived and is closed to further replies.

KevinM1

RSS help

Recommended Posts

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:

[code]
<?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

?>
[/code]

The problem lies at the forum_id - &amp; segment of the code.  Instead of returning something like:
website.com/forum/viewthread.php?rowstart=20[b]forum_id[/b]=4[b]&[/b]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.

Share this post


Link to post
Share on other sites
Could you please write what the variable $rstart shows. And why there is no &amp; before "forum_id="?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Should I be using htmlspecialchars_decode for the ampersand?  Or will it print correctly because it's within double-quotes?

Share this post


Link to post
Share on other sites
Try reading the tutorial [url=http://www.phpfreaks.com/tutorials/139/0.php]Creating dynamic RSS feeds[/url] :)
It should help you with creating a dynamic RSS feed.

Share this post


Link to post
Share on other sites
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:

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.