PDA

View Full Version : RSS Feed Code For Template?


vinyl-junkie
07-08-2004, 08:00 PM
I want to add the code for "view rss for this page" to my existing custom template but I can't figure out how to do that. Help!

vinyl-junkie
07-08-2004, 08:05 PM
I should clarify my question. I have ALLOW_RSS_FEED set to true. I put the following in my template:
<div align="center">
<phpdig:powered_by_link/>
</div>but all it gave me was "Powered By PhpDig." Shouldn't that give me the "RSS" thing?

Charter
07-10-2004, 05:59 AM
Hi. Take a look at search.php and see how it calls the custom page. Also in search. php check that the $rssdf variable is being passed to the phpdigSearch function call, where this function call is the one for the search results, not the RSS feed.

vinyl-junkie
07-11-2004, 08:21 AM
Ah, yes. There are differences in the 1.8.1 version of search.php. I don't recall you telling us that we had to overwrite that file to upgrade, but the old memory ain't what it used to be. ;)

Next question about that: I am now getting the "View RSS for this Page" link, but when I click on it, nothing happens. The RSS document is on the server because I checked that. Any idea what the problem could be?

Charter
07-11-2004, 08:43 AM
Hi. The MIME type is probably wrong. A MIME type of application/xml should work. There is also application/rss+xml and text/xml but check with your host or have a read here (http://www.wwwcoder.com/main/parentid/170/site/1880/68/default.aspx).

vinyl-junkie
07-11-2004, 10:55 AM
OK, I discovered the problem, quite by accident actually. I had the following statement in my .htaccess file:AddType application/x-httpd-php .php .php3 .php4 .phtml .js
That should have had .rss on the end of it. I don't remember why I thought I needed that statement in the first place, but after adding .rss to it, I got a parse error on line 1 for the .rss file, so I removed that line from my .htaccess altogether, and now all is right with the world again. :D

vinyl-junkie
07-16-2004, 08:53 PM
I'm still messing with this RSS thing. I have been able to create feeds, but the formatting is really screwy. Take a look, here (http://www.napathon.net/images/RSS-image.jpg). :( What can be done to fix it?

Charter
07-16-2004, 08:57 PM
What is that? Are you trying to stick images in the RSS feeds?

vinyl-junkie
07-16-2004, 09:02 PM
No. All I did was click on the "View RSS for this page" link on my search page, then add that feed to my news aggregator. That image is what the feed looks like from my news aggregator.

Charter
07-16-2004, 09:06 PM
Do a search here (http://www.phpdig.net/demo/search.php?query_string=apache+server), and then click the "View RSS for this Page" link. That shows valid RSS so I'm not sure what you're doing. What is a news aggregator? Is it meant to parse RSS feed?

vinyl-junkie
07-16-2004, 09:51 PM
Well, it turns out that I still had something messed up in my .htaccess file. I fixed that, but I still have the display problem.

To answer your question, a news aggregator is software to accumulate all your RSS feeds into a single place, and yes, it does parse the content for display. My feed from phpdig still isn't displaying correctly.

I just added a different feed to Awasu (my news aggregator). I notice the first news item displays all that HTML garbage but the other two in the list display okay (except for a &gt; but that's a separate problem). Anyway, is it possible that the XML is incorrect? Here (http://search.napathon.net/rss/10900425591375076543search.rss) is the latest RSS feed that I created.

Charter
07-16-2004, 10:11 PM
From http://www.xml.com/pub/a/tools/ruwf/check.html:

Your URL: http://search.napathon.net/rss/10900425591375076543search.rss

Congratulations the XML is well formed!

From http://feeds.archive.org/validator/:

This feed does not validate.

line 25, column 20: dc:date must be an W3CDTF date (3 occurrences)

<dc:date>07-13-2004</dc:date>

The feed isn't validating at the second site because you set mm-dd-yyyy in the config file instead of yyyy-mm-dd. Change that and it'll validate there too. It's possible that your RSS parser isn't handling the way the HTML entities are being coded for the RSS that comes with PhpDig. For instance, you see <span>foo</span> onscreen, but if you look at the RSS source, you'll see &amp;lt;span&amp;gt;foo&amp;lt;/span&amp;gt; instead.

vinyl-junkie
07-16-2004, 10:35 PM
I think you're right about it not parsing that data correctly for phpdig. If I changed the phpdig code to regular HTML entities, do you think it would break something somewhere else in phpdig?

Charter
07-16-2004, 10:42 PM
Just go to custom_search_page.php, look for the xmlentities function, and modify the function to whatever you want, and no, it won't break PhpDig outside of the feed. Even if you do break the RSS feed, the rest of PhpDig will be fine.