Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Oldiesmann in November 22, 2004, 11:56:25 VORMITTAG

Titel: Advertising Your Board's RSS Feed...
Beitrag von: Oldiesmann in November 22, 2004, 11:56:25 VORMITTAG
One of the great features in SMF is its XML and RSS functions. With one simple option enabled, SMF is capable of generating RSS and XML feeds for your board's news, member profiles and latest topics. Mozilla Firefox displays a special icon in the status bar when it detects an RSS feed on a site and even allows you to add RSS feeds to your bookmarks ("live bookmarks" - creates a folder in your bookmarks list for each feed and then puts the links generated by that feed in that folder, allowing you to easily access them). Anyway, Kelnage (http://www.simplemachines.org/community/index.php?action=profile;u=4129) indicated that it would be nice to see SMF automatically "advertise" the fact that you've got RSS feeds on your board. Here's how you do that:

First, make sure you've got it enabled (Admin -> Edit Features and Options -> Enable XML/RSS News).

Next:

Themes/yourtheme/index.template.php

Find
// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="', $scripturl, '?action=help" target="_blank" />
<link rel="search" href="' . $scripturl . '?action=search" />
<link rel="contents" href="', $scripturl, '" />';


Add after
// If RSS/XML news is enabled, indicate that an RSS feed is available
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="RSS" href="', $scripturl, '?type=rss;action=.xml;limit=20" />';


You can change that to your liking. Check out Sources/News.php for more info on all the XML feeds available. Once again, thanks to Kelnage (http://www.simplemachines.org/community/index.php?action=profile;u=4129) for mentioning how to "advertise" the feed.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: jcompton in November 22, 2004, 12:05:47 NACHMITTAGS
Is there more detail available on turning these feeds on? I do have that "one simple option enabled" but Yahoo's RSS module doesn't recognize my latest-post URL as a valid feed so presumably there's something a bit more to it than that.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Kelnage in November 22, 2004, 12:31:48 NACHMITTAGS
Your latest post isn't an RSS feed.

To get the RSS feed manually, the link is:

http://www.yourserver.com/foldername/index.php?type=rss;action=.xml;limit=20

That gets 20 messages. To get more or less, just change the last number.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: jcompton in November 22, 2004, 04:21:41 NACHMITTAGS
Ah, thanks. Looks like half the time Yahoo claims there's no new posts for the past 3 days, but I have no way of knowing whose fault that is offhand...
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: jcompton in November 22, 2004, 04:47:25 NACHMITTAGS
Actually, no, I still seem to be missing something here.

http://forums.pocketplane.net/index.php?type=rss;action=.xml;limit=6

This URL pulled up 5 items into My Yahoo, but those items are not updating. They're just getting older and older...
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Oldiesmann in November 22, 2004, 04:56:49 NACHMITTAGS
Works fine in Firefox. It's displaying links to the 6 most recent posts. I don't know how Yahoo handles this though.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Oldiesmann in November 22, 2004, 05:03:13 NACHMITTAGS
Everything Yahoo is showing is an hour old. I'm guessing it only gets headlines every hour or so.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Lum-chan in November 22, 2004, 07:44:17 NACHMITTAGS
Thanks for the tip Oldiesman, I finally got it working  ;D
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: [Unknown] in November 22, 2004, 07:52:06 NACHMITTAGS
I'm pretty sure the content type should be application/rss+xml.

-[Unknown]
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Oldiesmann in November 22, 2004, 08:38:02 NACHMITTAGS
That's just what Kelnage had. I'll change it though.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Kelnage in November 23, 2004, 03:31:21 NACHMITTAGS
Cheers [Unknown], I wasn't certain, but RSS worked with Firefox, and seeing as RSS readers are supposed to be extremely strict, I didn't think there was a problem.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Oldiesmann in November 23, 2004, 09:59:27 NACHMITTAGS
You can add multiple links too...

For example:

echo '
  <link rel="alternate" type="application/rss+xml" title="20 Most Recent Topics" href="', $scripturl, '?type=rss;action=.xml;limit=20" />
  <link rel="alternate" type="application/rss+xml" title="News" href="', $scripturl, '?type=rss;action=.xml;sa=news" />';


Then when you click on the little icon in Firefox, you will be given an option of which feed you want to subscribe to. :)
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: nosleep in Dezember 13, 2004, 05:00:14 VORMITTAG
ZitatActually, no, I still seem to be missing something here.

http://forums.pocketplane.net/index.php?type=rss;action=.xml;limit=6

This URL pulled up 5 items into My Yahoo, but those items are not updating. They're just getting older and older...


and what would the link be for example a section like this: Video and Photo Room

http://www.yourserver.com/foldername/index.php?type=rss;action=.xml;limit=20

because the quoted link doesn't pull from a specific section of the forum...
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: [Unknown] in Dezember 13, 2004, 05:03:09 VORMITTAG
Put ;board=XYZ on the link for a specific board.

-[Unknown]
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: nosleep in Dezember 13, 2004, 06:03:04 VORMITTAG
like this?

http://myhomepage.com/portal/forum/index.php?type=rss;action=.xml;limit=20;board=Politics and Sports

because I get this error when calling the feed:

Completed: with problems:
http://myhomepage.com/portal/forum/index.php?type=rss;action=.xml;limit=20;board=Politics and Sports


additionally: must I be logged in to call the feed, as that section is only available to loged in users.

can I possibly add my login and password to the string?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: [Unknown] in Dezember 13, 2004, 06:05:29 VORMITTAG
I'm afraid you have to look at the board's number.  For example, Tips and Tricks (http://www.simplemachines.org/community/index.php?board=72.0) is 72 - you cna tell from the URL.

-[Unknown]
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: nosleep in Dezember 13, 2004, 06:35:04 VORMITTAG
thank you, mine was a silly question on afterthought, should have known that from phpbb, on which it is the same.


but it won't pull the news. The board no. looks like this (on default template 1.0 preview):

....index.php/board,5.0.html

so do I have to call only the 5, or the 5.0, ot 5.0.html ?

have tried all three, but none will pull the news.

again, this section is only for logged in users.......
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: [Unknown] in Dezember 13, 2004, 07:07:11 VORMITTAG
It's just 5.  The 0 is the page number.

http://www.simplemachines.org/community/index.php?board=72;type=rss;action=.xml

Works here?

-[Unknown]
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: nosleep in Dezember 13, 2004, 07:13:41 VORMITTAG
tried that now as well, it won't pull the feed.... no clue why.

tried axatly you string above, only changed to my url.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Atari in Dezember 16, 2004, 08:36:06 NACHMITTAGS
I finally got a look at this but still not sure about something. Do I really need to edit? I tried the direct link and added to my bookmarks and it seems to work. I tried to look for that stuff in my template but its not there so I didn't add the extra code. ( I'm using helios template). Does that code give you some more control on what shows?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: [Unknown] in Dezember 16, 2004, 08:38:35 NACHMITTAGS
Zitat von: Atari in Dezember 16, 2004, 08:36:06 NACHMITTAGS
I finally got a look at this but still not sure about something. Do I really need to edit? I tried the direct link and added to my bookmarks and it seems to work. I tried to look for that stuff in my template but its not there so I didn't add the extra code. ( I'm using helios template). Does that code give you some more control on what shows?

Well, it tells Firefox that the feed exists.

Zitat von: nosleep in Dezember 13, 2004, 07:13:41 VORMITTAG
tried that now as well, it won't pull the feed.... no clue why.

tried axatly you string above, only changed to my url.

Had any luck since?

-[Unknown]
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: bleys988 in Januar 29, 2005, 11:35:28 VORMITTAG
I've converted from a previous instance - from yabbse, in fact. My forum only uses one theme, a converted one. My index.template.php doesn't  have this:

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="', $scripturl, '?action=help" target="_blank" />
<link rel="search" href="' . $scripturl . '?action=search" />
<link rel="contents" href="', $scripturl, '" />';


I've tried adding those lines to show Firefox the feed, but it doesn't seem to be working.

I don't know if it will help or not, but here's the text of my index.template.php, minus the css stylesheet stuff.


<?php
// Version: 1.0 Beta 5 Public; index

// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is always, images from the default theme will be used.
if this is defaults, images from the default theme will only be used with default templates.
if this is never, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';
}

// The main sub template above the content.
function template_main_above()
{
global $context$settings$options$scripturl$txt;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html'
$context['right_to_left'] ? ' dir="rtl"' '''><head>
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js"></script>
<script language="JavaScript" type="text/javascript"><!--
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
// --></script>
$context['html_headers'] . '
  <meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
  <meta content="' 
$context['page_title'] . '" name="description" />
  <meta content="PHP, MySQL, bulletin, board, free, open, source, yabb, yet, another, SE" name="keywords" />
  <meta content="mshtml 6.00.2600.0" name="generator" />
  <title>' 
$context['page_title'] . '</title>
  
</head>


// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['
user']['is_logged'])
{
echo '
', $txt[247], ' <b>', $context['user']['name'], '</b>, ';

// Are there any members waiting for approval?
if (!empty($context['
unapproved_members']))
echo '
<br />
', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=regcenter">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a', $txt['approve_members_waiting'];

// Is the forum in maintenance mode?
if ($context['
in_maintenance'] && $context['user']['is_admin'])
echo '
<br />
<b>', $txt[616], '</b>';
}
// Otherwise they'
re a guest so politely ask them to register or login.
else
echo '
'
$txt['welcome_guest'];

echo '';
if ($context['user']['is_logged'] && $context['allow_pm'])
echo $txt[152], ' <a href="'$scripturl'?action=pm">'$context['user']['messages'], ' ', ($context['user']['messages'] != $txt[153] : $txt[471]), '</a>'$txt['newmessages4'], '  '$context['user']['unread_messages'], ' ', ($context['user']['unread_messages'] == $txt['newmessages0'] : $txt['newmessages1']), '.';
echo '<br />' $context['current_time'] . '</font></td>
  </tr>
</table>
 </td>
  </tr><tr valign="middle" align="center" bgcolor="#99cc99">
 <td bgcolor="#99cc99" class="windowbg2"><font size="1">'
;

// Show the menu here, according to the menu sub template.
template_menu();

echo '</font></td>
  </tr>
  <tr>
 <td width="100%" bgcolor="#99cc99" height="24" class="windowbg2">&nbsp;'
;

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '<b>'$txt[102], ':</b> '$context['random_news_line'];

echo '</td>
  </tr>
</table>
 </td>
  </tr>
</table>
<br />
<table class="bordercolor" cellspacing="0" cellpadding="0" width="90%" align="center" bgcolor="#99cc99" border="0">
  <tr>
 <td>
<table class="bordercolor" cellspacing="1" cellpadding="0" width="100%" align="center" bgcolor="#99cc99" border="0">
  <tr>
 <td>
<table cellspacing="0" cellpadding="10" width="100%" align="center" bgcolor="#99cc99" border="0">
  <tr>
 <td valign="top" width="100%">
'
;
}

function 
template_main_below()
{
global $context$settings$options$scripturl$txt;

echo '
 </td>
  </tr>
</table>
 </td>
  </tr>
</table>
 </td>
  </tr>
</table>
<table cellspacing="0" cellpadding="0" width="90%" align="center" border="0">
  <tr>
 <td nowrap="nowrap" align="right">'
;

// Show a vB style login for quick login?
if ($context['show_vBlogin'])
echo '
<table cellspacing="0" cellpadding="0" border="0" align="center" width="90%">
<tr><td nowrap="nowrap" align="right">
<form action="'
$scripturl'?action=login2" method="post"><br />
<input type="text" name="user" size="7" />
<input type="password" name="passwrd" size="7" />
<select name="cookielength">
<option value="60">'
$txt['smf53'], '</option>
<option value="1440">'
$txt['smf47'], '</option>
<option value="10080">'
$txt['smf48'], '</option>
<option value="302400">'
$txt['smf49'], '</option>
<option value="-1" selected="selected">'
$txt['smf50'], '</option>
</select>
<input type="submit" value="'
$txt[34], '" /><br />
'
$txt['smf52'], '
</form>
</td></tr>
</table>'
;
else
echo '<br />';

echo '</td>
  </tr>
</table>
<br>

<table class="bordercolor" cellspacing="0" cellpadding="0" width="90%" align="center" bgcolor="#6394bd" border="0">
  <tr>
 <td>
<table class="bordercolor" cellspacing="1" cellpadding="0" width="100%" align="center" bgcolor="#6394bd" border="0">
  <tr>
 <td>
<table cellspacing="0" cellpadding="3" width="100%" bgcolor="#99cc99" border="0">
  <tr>
 <td valign="middle" align="right" width="25%" bgcolor="#99cc99">
<a href="http://www.mysql.com/"><img height="31" alt="Powered by MySQL" src="YaBBImages/mysql.gif" width="88" border="0" /></a>
<a href="http://www.php.net/"><img height="31" alt="Powered by PHP" src="YaBBImages/php.gif" width="88" border="0" /></a>
 </td>
 <td valign="middle" align="center" width="50%" bgcolor="#99cc99">'
theme_copyright(), '</td>
 <td valign="middle" align="left" width="25%" bgcolor="#99cc99">
<a href="http://validator.w3.org/check/referer"><img height="31" alt="Valid XHTML 1.0!" src="YaBBImages/valid-xhtml10.gif" width="88" border="0" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img height="31" alt="Valid CSS!" src="YaBBImages/vcss.gif" width="88" border="0" /></a> 
 </td>
  </tr>
</table>
 </td>
  </tr>
</table>
 </td>
  </tr>
</table>
'
;

// Show the load time?
if ($context['show_load_time'])
echo '
<div align="center" class="smalltext">
'
$txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'], '
</div>'
;

echo '</body>
</html>
'
;
}

// Show a linktree.  This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context$settings$options;

// Folder style or inline?  Inline has a smaller font.
echo '<span class="nav"'$settings['linktree_inline'] ? ' style="font-size: smaller;"' '''>';

// Each tree item has a URL and name.  Some may have extra_before and extra_after.
foreach ($context['linktree'] as $k => $tree)
{
// Show the | | |-[] Folders.
if (!$settings['linktree_inline'])
{
if ($k 0)
echo str_repeat('<img src="' $settings['images_url'] . '/icons/linktree_main.gif" alt="| " border="0" />'$k 1), '<img src="' $settings['images_url'] . '/icons/linktree_side.gif" alt="|-" border="0" />';
echo '<img src="' $settings['images_url'] . '/icons/folder_open.gif" alt="+" border="0" />&nbsp; ';
}

if (isset($tree['extra_before']))
echo $tree['extra_before'];
echo '<b>'$settings['linktree_link'] && isset($tree['url']) ? '<a href="' $tree['url'] . '" class="nav">' $tree['name'] . '</a>' $tree['name'], '</b>';
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($k != count($context['linktree']) - 1)
echo $settings['linktree_inline'] ? ' &nbsp;|&nbsp; ' '<br />';
}

echo '</span>';
}

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context$settings$options$scripturl$txt;

// Show the [home] and [help] buttons.
echo '
<a href="'
$scripturl'">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/home.gif" alt="' $txt[103] . '" border="0" />' $txt[103]), '</a>'$context['menu_separator'], '
<a href="'
$scripturl'?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/help.gif" alt="' $txt[119] . '" border="0" />' $txt[119]), '</a>'$context['menu_separator'];

// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="'
$scripturl'?action=search">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/search.gif" alt="' $txt[182] . '" border="0" />' $txt[182]), '</a>'$context['menu_separator'];

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '
<a href="'
$scripturl'?action=admin">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/admin.gif" alt="' $txt[2] . '" border="0" />' $txt[2]), '</a>'$context['menu_separator'];

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<a href="'
$scripturl'?action=profile">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/profile.gif" alt="' $txt[79] . '" border="0" />' $txt[467]), '</a>'$context['menu_separator'];

// The [calendar]!
if ($context['allow_calendar'])
echo '
<a href="'
$scripturl'?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/calendar.gif" alt="' $txt['calendar24'] . '" border="0" />' $txt['calendar24']), '</a>'$context['menu_separator'];
// Integrated Chat Mod Icon
if (!$context['user']['is_guest'])
echo '
<a href="'
$scripturl'?action=chat">', ($settings['use_image_buttons'] ? ' <img src="' $settings['images_url'] . '/' $context['user']['language'] . '/chat.gif" alt="' $txt['chatAlt'] . '" target="_blank" style="margin: 2px 0;" border="0" />' $txt['chatAlt']), '</a>'$context['menu_separator'];



// If the user is a guest, show [login] and [register] buttons.
if ($context['user']['is_guest'])
{
echo '
<a href="'
$scripturl'?action=login">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/login.gif" alt="' $txt[34] . '" border="0" />' $txt[34]), '</a>'$context['menu_separator'], '
<a href="'
$scripturl'?action=register">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/register.gif" alt="' $txt[97] . '" border="0" />' $txt[97]), '</a>';
}
// Otherwise, they might want to [logout]...
else
echo '
<a href="'
$scripturl'?action=logout;sesc='$context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' $settings['images_url'] . '/' $context['user']['language'] . '/logout.gif" alt="' $txt[108] . '" border="0" />' $txt[108]), '</a>';
}

?>




Thanks for any assitance!
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: [Unknown] in Januar 29, 2005, 01:31:45 NACHMITTAGS
Add it after this:

<meta content="mshtml 6.00.2600.0" name="generator" />

Like this:

<link rel="alternate" type="application/rss+xml" href="', $scripturl, '?type=rss2;limit=20;action=.xml" />

-[Unknown]
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: bleys988 in Januar 30, 2005, 11:24:24 VORMITTAG
That did the trick! Thanks a ton.

:)
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Pause in Januar 31, 2005, 10:20:52 VORMITTAG
Is there any way of modifying this slightly so that is it compatible with Firefox's Live Bookmarks?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: [Unknown] in Januar 31, 2005, 02:36:12 NACHMITTAGS
Zitat von: Mattitude in Januar 31, 2005, 10:20:52 VORMITTAG
Is there any way of modifying this slightly so that is it compatible with Firefox's Live Bookmarks?

WFM.  At least, rss2 does.... I've not tested RSS 0.93 with it, but I would expect it to work too.

-[Unknown]
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: bleys988 in Februar 01, 2005, 03:07:29 NACHMITTAGS
That's what I'm using. I changed the rss2 to rss, and I can verify that it does work with Firefox's Live bookmarks.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: theseus in Februar 27, 2005, 06:21:06 NACHMITTAGS
Zitat von: [Unknown] in Dezember 13, 2004, 07:07:11 VORMITTAG
It's just 5.  The 0 is the page number.

http://www.simplemachines.org/community/index.php?board=72;type=rss;action=.xml

Works here?

-[Unknown]

I had to put in the page number to get it to work properly. 

php?board=14.0;type...

Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Neol in Mai 19, 2005, 07:40:31 VORMITTAG
For me it doesn't work  :-\

Here is the code of my index template.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: ShadowStriker in Mai 28, 2005, 11:23:41 VORMITTAG
what is RSS feed? i dont see anything different: www.wwp.x10hsoting.com/general
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Oldiesmann in Juni 01, 2005, 10:38:00 VORMITTAG
XML.com (http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html) and Wikipedia (http://en.wikipedia.org/wiki/RSS_%28file_format%29) both have great articles that explain RSS. You won't notice any difference though unless you're using a browser that supports RSS detection, such as Firefox, Netscape 8 or Opera (IE currently does not support this).
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: culpeper in Juni 03, 2005, 03:15:10 NACHMITTAGS
Zitat von: Oldiesmann in November 22, 2004, 11:56:25 VORMITTAG
One of the great features in SMF is its XML and RSS functions. With one simple option enabled, SMF is capable of generating RSS and XML feeds for your board's news, member profiles and latest topics. Mozilla Firefox displays a special icon in the status bar when it detects an RSS feed on a site and even allows you to add RSS feeds to your bookmarks ("live bookmarks" - creates a folder in your bookmarks list for each feed and then puts the links generated by that feed in that folder, allowing you to easily access them). Anyway, Kelnage (http://www.simplemachines.org/community/index.php?action=profile;u=4129) indicated that it would be nice to see SMF automatically "advertise" the fact that you've got RSS feeds on your board. Here's how you do that:

First, make sure you've got it enabled (Admin -> Edit Features and Options -> Enable XML/RSS News).

Next:

Themes/yourtheme/index.template.php

Find
// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="', $scripturl, '?action=help" target="_blank" />
<link rel="search" href="' . $scripturl . '?action=search" />
<link rel="contents" href="', $scripturl, '" />';


Add after
// If RSS/XML news is enabled, indicate that an RSS feed is available
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="RSS" href="', $scripturl, '?type=rss;action=.xml;limit=20" />';


You can change that to your liking. Check out Sources/News.php for more info on all the XML feeds available. Once again, thanks to Kelnage (http://www.simplemachines.org/community/index.php?action=profile;u=4129) for mentioning how to "advertise" the feed.

Does this work in the background or should we see a link on the forum index.php page or something?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: rbrown3rd in Juni 25, 2005, 04:29:55 NACHMITTAGS
I am running SMF 1.05 slightly modded to run inside MKPortal.  I have added the code to my index.template.php, at least I think I have the right theme, but I still see nothing that shows an RSS feed.  I usually can figure this stuff out even though I am not a programmer but it is not working for me in this case.  I do have the Enable news/RSS feed turned on.  My Firefox is not detecting a feed.  Is it because of running it inside MKPortal?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: culpeper in Juni 25, 2005, 07:15:45 NACHMITTAGS
Have you validated the feed yet?

http://feedvalidator.org/

Also, check the page source online and make sure it is showing up as an alternate link.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: rbrown3rd in Juni 26, 2005, 12:25:28 NACHMITTAGS
Zitat von: culpeper in Juni 25, 2005, 07:15:45 NACHMITTAGS
Have you validated the feed yet?

http://feedvalidator.org/

No because I have don't know what the feed URL is yet.  I am pretty new at this.
Zitat
Also, check the page source online and make sure it is showing up as an alternate link.
No, it is not showing up.  How do I get it to show up as an alternate link?  I thought I had done that but apparently I didn't do it correctly.  Thanks for any help.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: rbrown3rd in Juni 26, 2005, 12:37:38 NACHMITTAGS
This is the section from my classic theme index.templates.php where I added the recommended code to "advertise" the RSS feed but no RSS link shows up for me.

Zitat// Show all the relative links, such as help, search, contents, and the like.
   echo '
   <link rel="help" href="', $scripturl, '?action=help" target="_blank" />
   <link rel="search" href="' . $scripturl . '?action=search" />
   <link rel="contents" href="', $scripturl, '" />';

    // If RSS/XML news is enabled, indicate that an RSS feed is available
   if (!empty($modSettings['xmlnews_enable']))
      echo '
      <link rel="alternate" type="application/rss+xml" title="RSS" href="', $scripturl, '?type=rss;action=.xml;limit=20" />';

   // If we're viewing a topic, these should be the previous and next topics, respectively.
   if (!empty($context['current_topic']))
      echo '
   <link rel="prev" href="' . $scripturl . '?action=;topic=' . $context['current_topic'] . '.0;prev_next=prev" />
   <link rel="next" href="' . $scripturl . '?action=;topic=' . $context['current_topic'] . '.0;prev_next=next" />';

Thanks again for any help you can give in getting my RSS feed to show up.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: culpeper in Juni 26, 2005, 03:26:50 NACHMITTAGS
What is the url to your message board?

Actually, I don't think this is the correct forum to be posting questions.  Post this problem on the english support forum and the oldies will start responding.

The problem is the actual url to the rss feed which will be something like this:

<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.tarawa-betio.org/coulterfranken/index.php?type=rss;action=.xml;limit=20" />

this should be visible online with the index.php file (in Firefox: view page source; or CTRL-U)
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: rbrown3rd in Juni 26, 2005, 06:51:16 NACHMITTAGS
Thanks.  I just posted the same question on the suggested forum.  My forum is at http://fs-freeflow.com/ where it is embedded in an MKPortal application.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: jazz in Juni 28, 2005, 04:40:10 NACHMITTAGS
Ok, I've done this but I'm not sure what it did.  It must be something in the background.  I see validation links in Firefox "View Source", so that must be it.  I have 2 questions.


Thanks!
Titel: If your RSS feed dates are screwed up.....
Beitrag von: slimandslam in Juli 24, 2005, 09:49:11 NACHMITTAGS
Don't know if this has been mentioned, but if you're getting the current date (or the same date) for all of your RSS feed items (and that's not right), then you need to make a change to your Source/News.php file:

Search for 'pubDate' in News.php and change all of these:

gmdate('D, d M Y H:i:s T'  ......

To these:

gmdate('D, d M Y H:i:s \G\M\T'   .....

What's happening is that your machine is generating "UTC" for the gmdate timezone and "UTC"
is not a valid part of RFC 822 time format. It has to be either "UT" or "GMT".  Sigh.

Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: willo in September 03, 2005, 02:07:31 NACHMITTAGS
The board advertising is working great with Firefox and Google.  Thank you everyone for posting this. 

I'm a little confused as to how the feeds are seen visually on the board.  I've played with settings (creating a link when RSS is on) in my index file,  but I believe my current theme does not have this built in.  I was able to manually add an RSS icon and link for the global, users, new, etc.  I'm wondering how difficult it would be to add icons for XML and RSS to each of the Boards and child boards automatically.   I would like to have two or three feed icons for each board and possibly the child boards if the site becomes more popular.  Has anyone done something like this?  Do you have an example of a site?  Any input or information is appreciated.

Willo
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: culpeper in September 09, 2005, 03:36:33 NACHMITTAGS
In Firefox, a little orange icon in the lower right corner if they feed is working correctly.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Vramin in November 16, 2005, 03:26:18 NACHMITTAGS
While this is all fine and good (Firefox sees my feed, etc.), I think by advertising the feed, they're talking about putting one of those little orange XML graphics on the page and letting people click it to see the feed, or drag it into their reader. I was able to do this with my phpBB board, but the browser doesn't know how to open the link rendered by the alternate link in the SMF board output. I haven't dug into the source, but I'm guessing it isn't rendering the doc type correctly. I'm trying to avoid hacking up the source, but is there something else I'm missing?

I'm using 1.1 RC1. The setting for enabling RSS is under the News and Newsletters option now, on by default. Again, it works fine with browsers that can see that alternate link, but to get one to show up somewhere else is what I'm interested in.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: culpeper in November 16, 2005, 11:59:17 NACHMITTAGS
Zitat von: culpeper in Juni 26, 2005, 03:26:50 NACHMITTAGS


Actually, I don't think this is the correct forum to be posting questions.  Post this problem on the english support forum and the oldies will start responding.


Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Vramin in November 21, 2005, 10:38:28 VORMITTAG
The right answer here is to use mod_rewrite to make it look like a real XML file on the server side while running your script to get the results. Put this in your .htaccess file:

RewriteEngine On
RewriteBase /yoursmfdir
RewriteRule ^rss.xml index.php?type=rss;action=.xml


Now you can make an image with an href that gets the feed that people can just click on or drag into their reader to read like this (uber-long conditional deleted):

http://www.mmo-town.com/rss.xml

Also, I noticed that the output RSS includes the poster's actual email address. The code is checking to see if some flag is set, but I don't know if it's checking it correctly. I fixed it by modifying line 822 of Sources/News.php:

'author' => $row['posterName'],

I noticed that the atom feed, a few lines below, was using this value - why they're different I'm not sure. I just didn't like that I was unknowingly advertising my user's email addresses.
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: carlatf in Januar 20, 2006, 01:13:33 NACHMITTAGS
HI,
I'd like to place an icon with a link inside SMF to show that the RSS feed of the current board is available.
I'm going to do it with:
   if (!empty($modSettings['xmlnews_enable']))
      echo '
   <a href="', $scripturl, '?type=rss;action=.xml" type="application/rss+xml" title="', $context['forum_name'], ' - RSS"/>RSS  current board name</a>';

I'd like to put the current board name, can anyone tell me the code? current_board_name?

peace,
Carla
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: algurgazan in Januar 23, 2006, 02:43:26 NACHMITTAGS
im use the rss feed in combination with firefox, and it works like a charm, but it slightly annoys me that my time being online on my forum skyrockets because firefox refreshes the feed every ten minutes. id like to exclude the rss feed checking from the thing that counts my online time but im a bit stuck cause i can't really find where this happens.. any help here?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: RoarinRow in März 05, 2006, 11:55:26 NACHMITTAGS
Is there a down side to using this feed?  Hacking attempts, member privacy, etc.? 
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Stuart in April 01, 2006, 09:42:48 VORMITTAG
Zitat von: [Unknown] in Dezember 13, 2004, 07:07:11 VORMITTAG
It's just 5.  The 0 is the page number.

http://www.simplemachines.org/community/index.php?board=72;type=rss;action=.xml

Works here?

-[Unknown]

That's kinda odd as it's working for only a couple of my boards. For example it works fine with board 1 and 2 but it's not working at all with board 27  :-\

Anyone any suggestions?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: tomis in Mai 10, 2006, 10:22:08 VORMITTAG
I must be totally blind.  I can't find where to activate RSS feeds withing the Admin panel.  I'm running v. 1.1 RC2 (The latest version, downloaded on May 2nd).  And I looked at Features & Options like the OP said, but I can't find anything there for RSS/XML feeds. Can anyone help me?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Miyagi in Juni 30, 2006, 09:43:01 VORMITTAG
Hi Tomis,

I believe RSS is fully functioning by default in 1.1 RC2.. No need to activate anything :)
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: PrizeLive.com in Juli 02, 2006, 11:54:33 VORMITTAG
Zitat von: Miyagi in Juni 30, 2006, 09:43:01 VORMITTAG
Hi Tomis,

I believe RSS is fully functioning by default in 1.1 RC2.. No need to activate anything :)

How do you access it?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: spiros in Juli 29, 2006, 08:56:28 VORMITTAG
Actually i have been wondering the same thing for a long time now... as I said elsewhere activating a feed should also display a feed icon providing different feeds for each forum/category/board / topic.

What have you managed to do so far?

Zitat von: carlatf in Januar 20, 2006, 01:13:33 NACHMITTAGS
HI,
I'd like to place an icon with a link inside SMF to show that the RSS feed of the current board is available.
I'm going to do it with:
   if (!empty($modSettings['xmlnews_enable']))
      echo '
   <a href="', $scripturl, '?type=rss;action=.xml" type="application/rss+xml" title="', $context['forum_name'], ' - RSS"/>RSS  current board name</a>';

I'd like to put the current board name, can anyone tell me the code? current_board_name?

peace,
Carla
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: dvk01 in September 28, 2006, 04:35:03 VORMITTAG
Zitat von: Miyagi in Juni 30, 2006, 09:43:01 VORMITTAG
Hi Tomis,

I believe RSS is fully functioning by default in 1.1 RC2.. No need to activate anything :)

admin CP / news & newsletters /settings
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: Chad in Oktober 18, 2006, 02:15:00 NACHMITTAGS
can we use categories (and multiple categories) for our rss feed?  like:
category=1,7,2;type=rss;action=.xml
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: davomex in März 08, 2007, 07:24:02 VORMITTAG
helo oldiesman, am a complete novice to the stuff of smf but i have a forum installed already using fantastico, but i need to customise it to my taste but am lost in the whole process. i have a minimal knowlege of HTLM just tell me what to do step by step and i will be able to go trough it. i have read again and again the online manual and i dont seem to coordinate the stuff there so what do i do,
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: emomoney in März 15, 2007, 09:05:34 NACHMITTAGS
Zitat von: Oldiesmann in November 22, 2004, 04:56:49 NACHMITTAGS
Works fine in Firefox. It's displaying links to the 6 most recent posts. I don't know how Yahoo handles this though.
I've yet to get my feeds to display in Firefox.  The show display just fine in Fox News.  I've tried all sorts of combinations. 
index.php?type=rss2;action=.xml
index.php?type=rss;action=.xml
index.php?;action=.xmltype=rss2
index.php?;action=.xmltype=rss
I've used the sa=recent, limit=x,  still nothing.
Any suggestions?
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: F4r4Zm0In in Januar 17, 2009, 04:06:43 VORMITTAG
Just for those who don't know about it:

In SMF   version 2.0 Post Beta 4 this Mod/Trick comes built in

It means you don't have to install any mods or do any edits

Just point your browser @ http://security.iblogger.org/index.php?type=rss;action=.xml;limit=20

Replace http://security.iblogger.org/ with your sites name

Regards
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: codwarrior in März 17, 2009, 08:34:31 NACHMITTAGS
I am confused on the URL of the rss feed for the news. I know the URL of the recent posts feed. For my forum it is http://www.warriorlocomotive.com/forum/index.php?type=rss;action=.xml
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: agbattery in März 23, 2009, 04:07:57 NACHMITTAGS
Great coding thanks for the help
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: ArkServer in März 23, 2009, 07:52:36 NACHMITTAGS
http://www.engineeringserver.com/forum/index.php?type=rss;action=.xml;limit=20 my board's url if you are into programming :)
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: burnsie in Mai 01, 2009, 07:33:49 VORMITTAG
Ive setup the rss feed onto my site but the rss feed is going out without any title?? any ideas??

Thanks
Titel: Re: Advertising Your Board's RSS Feed...
Beitrag von: N3RVE in Juli 06, 2009, 04:57:19 NACHMITTAGS
Please, read this topic :)
Getting the Most Out of SMF - XML, RSS and RSS2 (and Atom and RDF) feeds (http://www.simplemachines.org/community/index.php?topic=25009.0)

-[n3rve]