News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Advertising Your Board's RSS Feed...

Started by Oldiesmann, November 22, 2004, 11:56:25 AM

Previous topic - Next topic

[Unknown]

Quote from: Atari on December 16, 2004, 08:36:06 PM
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.

Quote from: nosleep on December 13, 2004, 07:13:41 AM
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]

bleys988

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!

[Unknown]

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]

bleys988


Pause

Is there any way of modifying this slightly so that is it compatible with Firefox's Live Bookmarks?
"You and me, inside that box, now." - The Doctor

Bite Fusion
Fusion Web Network
VG Fusion
Wrestling Fusion + Wrestling Fusion Forums

[Unknown]

Quote from: Mattitude on January 31, 2005, 10:20:52 AM
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]

bleys988

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.

theseus

Quote from: [Unknown] on December 13, 2004, 07:07:11 AM
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...


Neol

For me it doesn't work  :-\

Here is the code of my index template.


Oldiesmann

XML.com and Wikipedia 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).
Michael Eshom
Christian Metal Fans

culpeper

Quote from: Oldiesmann on November 22, 2004, 11:56:25 AM
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 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 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?

rbrown3rd

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?

culpeper

#33
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.

rbrown3rd

Quote from: culpeper on June 25, 2005, 07:15:45 PM
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.
Quote
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.

rbrown3rd

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.

Quote// 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.

culpeper

#36
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)

rbrown3rd

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.

jazz

#38
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.


  • How does this Advertise the RSS Feed?
  • Using Live bookmarks, it will show the topics from hidden the hidden boards, Admin and Moderator.  How do I exclude these boards?

Thanks!

slimandslam

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.


Advertisement: