1 (edited by pogenwurst 2005-08-26 23:47)

Topic: RSS Autodiscovery

To add RSS autodiscovery links (for Firefox livemarks) to my forum, I used the following code:

<?php
// Edits for RSS autodiscovery
echo ("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"New topics feed.\" href=\"extern.php?action=new&type=rss\"/>\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Recent activity feed.\" href=\"extern.php?action=active&type=rss\"/>\n");
if ($id) {
$auto_discover_new = '<link rel="alternate" type="application/rss+xml" title="New topics feed for forum #'.$id.'." href="extern.php?action=new&type=rss&fid='.$id.'"/>';
$auto_discover_active = '<link rel="alternate" type="application/rss+xml" title="Recent activity feed for forum #'.$id.'." href="extern.php?action=active&type=rss&fid='.$id.'"/>';
echo ($auto_discover_new . "\n" . $auto_discover_active . "\n");
}
?>

Add it to header.php. I suggest putting in under "</title>" around line 70.
My PHP isn't that great, so revisions are welcome.

If for some reason you want to see this in action (if you would call it "action"), click the link in my sig.

I hope this helps somebody!

EDIT: See below for new code.
EDIT: It appears that keyes has addressed this kind of thing already. You might try using code from both this thread and the other one to have the most effective solution.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: RSS Autodiscovery

Darn it - I just now noticed a mistake. It interprets topic IDs as forum IDs. I'll see if I can fix that.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: RSS Autodiscovery

New code:

<?php
// Edits for RSS autodiscovery
echo ("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"New topics feed.\" href=\"extern.php?action=new&type=rss\"/>\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Recent activity feed.\" href=\"extern.php?action=active&type=rss\"/>\n");
if ($id) { if (ereg('viewforum.php', $REQUEST_URI)) {
$auto_discover_new = '<link rel="alternate" type="application/rss+xml" title="New topics feed for forum #'.$id.'." href="extern.php?action=new&type=rss&fid='.$id.'"/>';
$auto_discover_active = '<link rel="alternate" type="application/rss+xml" title="Recent activity feed for forum #'.$id.'." href="extern.php?action=active&type=rss&fid='.$id.'"/>';
echo ($auto_discover_new . "\n" . $auto_discover_active . "\n");
}}
?>

Seems to work fine now.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: RSS Autodiscovery

Works great thanks.

Re: RSS Autodiscovery

rootuid wrote:

Works great thanks.

No problem.

Looking for a certain modification for your forum? Please take a look here before posting.