simple RSS mod for phpBB3

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
windrider07
Registered User
Posts: 60
Joined: Thu May 08, 2008 10:26 pm

Re: simple RSS mod for phpBB3

Post by windrider07 »

IS there a way where you can make it so that the rss feed can be shown on a separate webpage like on the main page of a CMS rather than the main board index of the forum?
User avatar
daGrevis
Registered User
Posts: 146
Joined: Sat Jan 10, 2009 7:41 am
Location: Latvia

Re: simple RSS mod for phpBB3

Post by daGrevis »

All works (3.0.4) just fine! Thanks for mod! :)
mre03
Registered User
Posts: 149
Joined: Mon Apr 05, 2004 12:02 pm

Re: simple RSS mod for phpBB3

Post by mre03 »

is this rssfeed valid now? because it says its not for my feed
theduffman
Registered User
Posts: 4
Joined: Thu Sep 25, 2008 12:45 am

Re: simple RSS mod for phpBB3

Post by theduffman »

Hi, my link to the RSS feed is placed in the overall header on the right hand side list as advised. But, mysteriously, this list disappears upon a refresh in firefox. Not just the RSS image, but the whole list.

My forum is 3.0.4 with 3 other minor mods that work fine together and it's at http://www.felicifia.org

Can anyone offer support on this problem?
Last edited by theduffman on Thu Jan 22, 2009 2:25 am, edited 2 times in total.
Antheii
Registered User
Posts: 30
Joined: Tue Jun 07, 2005 10:11 am
Location: Netherlands

Re: No images in feed

Post by Antheii »

Hi,

On our messageboard a lot of images are posted, using external file hosters (so no uploads permitted). But I wanted them out of the RSS feed, so I replaced them with links to those images.

Find

Code: Select all

$board_url = generate_board_url();
Below, add;

Code: Select all

$cleaning = array(
	"/\[url\=(.*?)\:(.*?)\](.*?)\[img\:(.*?)\](.*?)\[\/img\:(.*?)\](.*?)\[\/url\:(.*?)\]/is" => "<a href=\"$5\" target=\"_new\">image</a>",
	"/\[img\:(.*?)\](.*?)\[\/img\:(.*?)\]/is" => "<a href=\"$2\" target=\"_new\">image</a>",
	"/<img src=\"\{SMILIES_PATH\}\//is" => "<img src=\"$board_url/images/smilies/"
);
(the first two lines are for those images, the third line actually is for transforming the URI's of the smileys to absolute URI's instead of relative URI's to comply with RSS standards.)

Find

Code: Select all

$topic_link   = $board_url."/viewtopic.".$phpEx."?f=".$forumid."&t=".$topicid;
.
Below add;

Code: Select all

	    $tptxt = $row['post_text'];
	    $tptxt = preg_replace(array_keys($cleaning), array_values($cleaning), $tptxt);
Find

Code: Select all

$description  = $user->lang['POST_BY_AUTHOR']." ".$row['topic_last_poster_name']." 
Inline find

Code: Select all

$row['post_text']
Replace by

Code: Select all

$tptxt
Don't know how this would work when you allow images to be uploaded to your forum though!

Hope this is of use to somebody (although a real PHP guru probably would produce a better code, and most likely this is not to phpBB standards ;-) )

Hans
Last edited by Antheii on Tue Jan 20, 2009 12:36 am, edited 1 time in total.
Antheii
Registered User
Posts: 30
Joined: Tue Jun 07, 2005 10:11 am
Location: Netherlands

Re: simple RSS mod for phpBB3

Post by Antheii »

Hi,

As we were experiencing performance issues, including the "Too many connections [1040]"-error (yeah, I know, we should look for another provider...), I decided to try to cache this RSS feed, as it looked it was the main perpetrator,

This was my first attempt to make some caching, so I guess there are better ways (any advice would be appreciated!), but this is how I did it;

Find

Code: Select all

/**
* @ignore
*/
Below, add

Code: Select all

// Use cached file or not
$cache_time = 180; // Time in seconds before new feed is generated
$cache_filename = 'cache/rsscache'; // Location to lookup or store cached file

// Check to see if this file has already been cached    
// If it has get the file creation time and compare with cache_time
if (file_exists($cache_filename) && 
           (time() - $cache_time < filemtime($cache_filename))) 
        {
        	header('Content-type: application/rss+xml; charset=UTF-8');
	readfile($cache_filename);
	echo "<!-- Cache generated at ".date(DATE_RFC822, filemtime($cache_filename))."-->";
        	exit;
        }

ob_start(); // Turns on output buffering  
//end caching
Off course you can alter the value of $cache_time to your needs.
The ECHO is to check in the source of the output whether the cache file is used or a new feed was generated. You can remove this line if you like.

Find

Code: Select all

$db->sql_freeresult($result);
Above, add

Code: Select all

// write output to cache_filename
file_put_contents($cache_filename, ob_get_contents());  
ob_end_flush();
//end write output
The effect of this is, that only once every 180 seconds a new feed is generated, so limiting the connections to the database to once every 180 seconds.
All RSS users will get the content of the cached file during those 3 minutes in between.

One thing I still need to tackle, is getting 101% sure that even when a moderator or administrator calls the RSS feed while logged in, it will not include messages from closed/hidden forums being written to the cache file, because everybody will then be able to see those.
Not sure (yet) how this mechanism works though.

Hans
User avatar
daGrevis
Registered User
Posts: 146
Joined: Sat Jan 10, 2009 7:41 am
Location: Latvia

Re: simple RSS mod for phpBB3

Post by daGrevis »

All works just fine, and thank guy, but after reinstall my forum, when i click to rss icon (go to rss.php), it offer my to download file - rss.php... :( Same on IE, as FF... :(
deepan
Registered User
Posts: 28
Joined: Wed Jan 21, 2009 11:32 am

Re: simple RSS mod for phpBB3

Post by deepan »

Friends i use serenity green style can some one tell me how to add rss for this style...
Please help me :idea: :idea:
dan909
Registered User
Posts: 54
Joined: Sun Feb 17, 2008 7:09 pm

Re: simple RSS mod for phpBB3

Post by dan909 »

deepan wrote:Friends i use serenity green style can some one tell me how to add rss for this style...
Please help me :idea: :idea:
Are installation instructions not similar?
Last edited by dan909 on Mon Jan 26, 2009 2:13 pm, edited 1 time in total.
deepan
Registered User
Posts: 28
Joined: Wed Jan 21, 2009 11:32 am

Re: simple RSS mod for phpBB3

Post by deepan »

I tried following this method below for my serenity green style:
but i was not able to see the rss icon and the feed was also not working...please help :idea: :idea:
hug3 wrote:for subsilver2 template
****************************************************************************************************************************

Code: Select all

File Copy

Copy: root/rss.php 
To: root/rss.php 

Copy: root/styles/prosilver/theme/images/icon_rss.gif 
To: root/styles/subsilver2/theme/images/icon_rss.gif 

Code: Select all

Open: styles/subsilver2/template/overall_header.html
Find Code: 
<td class="genmed" align="{S_CONTENT_FLOW_END}">

Add on the next line Code: 
<a href="{U_RSS}"><img src="{T_THEME_PATH}/images/icon_rss.gif" width="12" height="13" alt="*" />{L_RSS_EXPLAIN}</a>&nbsp; &nbsp;

Code: Select all

Open: language/en/common.php
Find Code:
'EXTENSION_DISABLED_AFTER_POSTING'	=> 'The extension <strong>%s</strong> has been deactivated and can no longer be displayed.',

Add on the next line Code: 
//rss feed code
  'RSS_EXPLAIN'	  =>'RSS ',	
  'RSS_READ_TOPIC' =>'Read Main Topic',
  'RSS_COPYRIGHT' =>'Copyright by',
  'RSS_FAILURE'	=>'Failed to get latest topics',

Code: Select all

Open: includes/functions.php
Find Code:
'U_RESTORE_PERMISSIONS'	=> ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '',

Add on the next line Code: 
//rss feed code
    'U_RSS'			=>append_sid("{$phpbb_root_path}rss.$phpEx"), 
***************************************************************************************************************************
save the files re-upload them,
refresh the template and go get it
User avatar
daGrevis
Registered User
Posts: 146
Joined: Sat Jan 10, 2009 7:41 am
Location: Latvia

Re: simple RSS mod for phpBB3

Post by daGrevis »

Can some one can help me with my problem? (Higher!)
Antheii
Registered User
Posts: 30
Joined: Tue Jun 07, 2005 10:11 am
Location: Netherlands

Re: simple RSS mod for phpBB3

Post by Antheii »

daGrevis wrote:Can some one can help me with my problem? (Higher!)
Could you give a link to your forum?

Hans
Antheii
Registered User
Posts: 30
Joined: Tue Jun 07, 2005 10:11 am
Location: Netherlands

Re: simple RSS mod for phpBB3

Post by Antheii »

Hi,
deepan wrote:I tried following this method below for my serenity green style:
but i was not able to see the rss icon and the feed was also not working...please help :idea: :idea:
In the code you placed here, it says
Open: styles/subsilver2/template/overall_header.html
Did you adjust the overal_header.html in styles/serenitygreen/template too?

Hans
User avatar
daGrevis
Registered User
Posts: 146
Joined: Sat Jan 10, 2009 7:41 am
Location: Latvia

Re: simple RSS mod for phpBB3

Post by daGrevis »

Antheii wrote:
daGrevis wrote:Can some one can help me with my problem? (Higher!)
Could you give a link to your forum?

Hans
Sorry, I cant, because its on localhost, but i can give you screen shot...

Image

Any ideas?
deepan
Registered User
Posts: 28
Joined: Wed Jan 21, 2009 11:32 am

Re: simple RSS mod for phpBB3

Post by deepan »

Antheii wrote:Hi,
deepan wrote:I tried following this method below for my serenity green style:
but i was not able to see the rss icon and the feed was also not working...please help :idea: :idea:
In the code you placed here, it says
Open: styles/subsilver2/template/overall_header.html
Did you adjust the overal_header.html in styles/serenitygreen/template too?

Hans
i had copied the file icon file to root/styles/serenitygreen/theme/images/icon_rss.gif
and changed the following files styles/serenitygreen/template/overall_header.html
language/en/common.php
includes/functions.php

i didn't do the changes inside subsilver2 or prosilver style folder becoz i use only serenitygreen style

Return to “[3.0.x] MOD Database Releases”