vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   RSS feed displayed in forumdisplay (https://vborg.vbsupport.ru/showthread.php?t=117235)

MickDoneDee 05-31-2006 07:33 PM

RSS feed displayed in forumdisplay
 
I'm not a coder but I managed, through trial and error, to get an external RSS feed to display within a scrollable table on forumdisplay. I have several different feeds displayed on separate forums.

Examples:
http://www.world-a-team.com/forumdisplay.php?f=3
http://www.world-a-team.com/forumdisplay.php?f=4
http://www.world-a-team.com/forumdisplay.php?f=7

Each separate feed requires a pair of files uploaded to your server. A php and html file. The php file contains the feed URL.
eg: $XMLfilename = "http://www.cricinfo.com/rss/wc_2007.rdf";

The HTML file contains variables that get replaced by different parts of the feed. The php file addresses the html file.
eg: $TEMPLATEfilename = "rsswc.html";

In the phpinclude_start template I use
ob_start();
require("rssaus.php");
$rssaus = ob_get_contents();
ob_end_clean();

to create a variable - eg: $rssaus which I place in a conditional in the forumdisplay template.
eg:
$header
$navbar
<if condition="$foruminfo['forumid'] == 3">$rsseng</if>
<if condition="$foruminfo['forumid'] == 4">$rssaus</if>
<if condition="$foruminfo['forumid'] == 5">$rsssaf</if>
<if condition="$foruminfo['forumid'] == 6">$rsspak</if>
<if condition="$foruminfo['forumid'] == 7">$rssind</if>

So I can display a different feed on different forums.

MickDoneDee 07-31-2007 07:04 PM

The system I used in the previous post was for my 3.0.3 version forum. I've since upgraded my forum to 3.6.7 and I no longer use the phpinclude_start template.

Instead, I create a plugin that references the PHP files. I create a Plug-in for global_start with these contents:
ob_start();
require("rssaus.php");
$rssaus = ob_get_contents();
ob_end_clean();

The plugin also contains the above code repeated for each different feed I fetch via a different PHP file, eg rsseng.php, rsspak.php etc.

The code in rssaus.php will execute and any output generated by this script will be stored in $rssaus. Then I place $rssaus in the FORUMDISPLAY template where I want the contents of the PHP file (RSS feed) to appear. For multiple feeds on different forums I use something like:

eg:
$header
$navbar
<if condition="$foruminfo['forumid'] == 3">$rsseng</if>
<if condition="$foruminfo['forumid'] == 4">$rssaus</if>
<if condition="$foruminfo['forumid'] == 5">$rsssaf</if>
<if condition="$foruminfo['forumid'] == 6">$rsspak</if>
<if condition="$foruminfo['forumid'] == 7">$rssind</if>

rnmcd 08-19-2007 02:28 AM

Can you post the plugin?

Do you think you will upgrade to 3.6.8?

MickDoneDee 08-19-2007 11:49 AM

Quote:

Originally Posted by rnmcd (Post 1320691)
Can you post the plugin?

I have posted the plugin in the previous post.
Quote:

Instead, I create a plugin that references the PHP files. I create a Plug-in for global_start with these contents:
ob_start();
require("rssaus.php");
$rssaus = ob_get_contents();
ob_end_clean();
For multiple RSS feeds simply repeat this block of code and change the name of the PHP file. For example:
Quote:

ob_start();
require("rssaus.php");
$rssaus = ob_get_contents();
ob_end_clean();
ob_start();
require("rsseng.php");
$rsseng = ob_get_contents();
ob_end_clean();
ob_start();
require("rssind.php");
$rssind = ob_get_contents();
ob_end_clean();
ob_start();
require("rssnz.php");
$rssnz = ob_get_contents();
ob_end_clean();
Please download the following free scripts and read the documentation on how to create your custom RSS PHP and HTML files:

http://www.feedforall.com/download.htm

Script 1:
RSS2HTML - free PHP script for dipslaying RSS feeds using html
(You don't have to register at feedforall.com to download this free file.)
Description:
http://www.feedforall.com/free-php-script.htm
Documentation:
http://www.feedforall.com/php-documentation.htm

Script 2:
rss2html Cache - PHP script for displaying only current items in an RSS feed.
(You are required to register at feedforall.com to download this free file)
Description:
http://www.feedforall.com/rss-cache.htm

This should work for 3.6.8.

perfphysio 08-19-2007 11:54 AM

This is a fab idea. The only issue is for a few of us that aren't so techie this abvove description is still a bit difficult to follow. Perhaps you could post a link to a step by step html page?

Many thanks if this is posibble for your time :)

MickDoneDee 08-19-2007 12:24 PM

1 Attachment(s)
In my first post I gave you an example of code to place in your forum display template:
Quote:

to create a variable - eg: $rssaus which I place in a conditional in the forumdisplay template.
eg:
$header
$navbar
<if condition="$foruminfo['forumid'] == 3">$rsseng</if>
<if condition="$foruminfo['forumid'] == 4">$rssaus</if>
<if condition="$foruminfo['forumid'] == 5">$rsssaf</if>
<if condition="$foruminfo['forumid'] == 6">$rsspak</if>
<if condition="$foruminfo['forumid'] == 7">$rssind</if>

So I can display a different feed on different forums.
I also gave you an example of the code for the plugin in my previous post.

On my server is a folder called FeedForAllCacheFiles which is CHMODed to 777 to store the cached RSS feed files. The documentation should explain this. If it doesn't let me know. I also have a PHP and HTML file corresponding to each feed. For example:

rssaus.php and rssaus.html to display the feed on the Australia forum.
rsseng.php and rsseng.html to display the feed on the England forum.
rssind.php and rssind.html to display the feed on the India forum. Etc.

To view the code of rssaus.php open the attached file. To view the html code of rssaus.html open the attached text file: rssaus.txt. I hope this helps.

tekguru 08-19-2007 03:01 PM

Sounds cool but or us newbies it it as rewritten into a Product and had an ACP entry to configure it I'd be using it.

rnmcd 08-19-2007 03:35 PM

Does anyone know if it is even possible for it to be written into a product with admincp controls?

tekguru 08-19-2007 05:15 PM

I would have thought it would be possible and get rid of the need to edit the tamplates?

rnmcd 08-22-2007 02:29 AM

If it is possible to turn this into a product/plugin I will pay to have it coded.

MickDoneDee 08-22-2007 03:30 AM

Which part of the install are you having difficulty with? The install requires creating a plugin via admincp, editing the forumdisplay template in admin cp, creating your custom php and html file from the template files supplied by FeedForAll.com and uploading them to your server, adding the URL of the rss feed to the php file, creating a folder to cache the feed.

If you need assistance with any part then PM me.

rnmcd 08-23-2007 06:54 PM

MickDoneDee, is there a setting that allows you to specify how long the RSS items display on the forumdisplay page?

For example, I noticed that on http://www.world-a-team.com/australia-cricket-forum/ your items seem to be from today only.

Is it possible for the items to display for a longer duration?

Are the earlier RSS items automatically deleted when the latest feed is updated?

Thanks.

amnesia623 08-31-2007 07:29 PM

I can't believe it.

I just found this thread, but I am using the same exact setup on a new theme I'm creating for my board. I want to load news feeds from different sources based on forums.

Now, my question and concern is this:

1) loading all the feeds into global start: doesn't that slow the board down? Even if it's pulling from the cache doesn't it have to load all the feeds into the variables but only display the variable according to the condition on ForumHome? I would like to find a way that it only loads the appropriate feed based on the forum.

2) Couldn't you create multiple hooks, assign a different feed per hook, and load the corosponding hook based on a condition? ie: <if condition="$foruminfo['forumid'] == 7">hook_name</if>

3) Or is there a way to load the rss2html.php file into a plugin and have the plugin communicate with the board so the forum id is passed to the plugin and loads the appropriate feed based on the forum id ie... (from the rss2html.php file)

if (forumID == 2) {
$XMLfilename = "http://www.tmz.com/rss.xml";}

I'm just thinking, at least for myself, there has to be a more efficient way to get this to work.

It's a great way to get fresh content on your site though!

MickDoneDee 08-31-2007 11:29 PM

Quote:

Originally Posted by rnmcd (Post 1324251)
MickDoneDee, is there a setting that allows you to specify how long the RSS items display on the forumdisplay page?

There is a setting in the FeedForAll_Scripts_CachingExtension.php file that controls how long the current feed remains in your cache before a fresh copy is fetched. The fresh copy, however, may still be the same if you are fetching every 6 hours but the feed content is only updated every 24 hours by the website producing the feed.

Code:

  // The variable $cacheTTL controls how many seconds a cached copy of an XML
  // file can be used before it must be refetched from the server.
  // $cacheTTL=60;      //cache files for 1 minute
  // $cacheTTL=3600;    //cache files for 1 hour
  $cacheTTL=21600;  //cache files for 6 hours

I can't publish the entire file here because you have to register on feedforall.com to download this free file.
Quote:

Originally Posted by rnmcd (Post 1324251)
For example, I noticed that on http://www.world-a-team.com/australia-cricket-forum/ your items seem to be from today only.

Is it possible for the items to display for a longer duration?

Are the earlier RSS items automatically deleted when the latest feed is updated?

Thanks.

As you can see from the above code it's possible to control how long you display a cached feed. The current feed will stay in cache and display on your forum until it refetches the feed and overwrites the current feed. Depending on how often the feed is updated with new content from the RSS source website your forumdisplay may or may not show new content.

Quote:

Originally Posted by amnesia623 (Post 1329691)
I can't believe it.

I just found this thread, but I am using the same exact setup on a new theme I'm creating for my board. I want to load news feeds from different sources based on forums.

Now, my question and concern is this:

1) loading all the feeds into global start: doesn't that slow the board down? Even if it's pulling from the cache doesn't it have to load all the feeds into the variables but only display the variable according to the condition on ForumHome? I would like to find a way that it only loads the appropriate feed based on the forum.

You're right that it could be done more efficiently. In debug mode, I can see that 12 rss related files are included on every forum page. This may be extra PHP work that is unnecessary. I'll try your suggestions and report back.

amnesia623 09-01-2007 04:45 AM

I'm away from my home PC now, but I'll look into it too when I get back.

I actually went to feedforall.com and purchased the access to the scripts directory so I have access to their caching script and other scripts. Maybe I should use RSStoMySQL and get feeds that way?

What I need to do is learn how to make plugins and hook locations.

Another possibility would be load the feed thru rss2html in an iframe or ajax so it doesn't slow the loading of the forum pages.

I hope I can get this worked out so I can get rss feeds posted on the page to get new content on the page all the time ....and give people things to talk about.

MickDoneDee 09-01-2007 11:29 AM

I've changed the hook location to forumdisplay_start and now the rss files are only included when a forum is viewed in the browser. That will probably reduce the amount of PHP work on other pages.

I've also successfully changed the plugin code so that only the relevent rss.php file is included when the corresponding forum is viewed.

Code:

    if($foruminfo['forumid'] == 3)
    {
        ob_start();
        require("rsseng.php");
        $rsseng = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 4)
    {
        ob_start();
        require("rssaus.php");
        $rssaus = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 5)
    {
        ob_start();
        require("rsssaf.php");
        $rsssaf = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 6)
    {
        ob_start();
        require("rsspak.php");
        $rsspak = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 7)
    {
        ob_start();
        require("rssind.php");
        $rssind = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 8)
    {
        ob_start();
        require("rssnz.php");
        $rssnz = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 9)
    {
        ob_start();
        require("rsssl.php");
        $rsssl = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 9)
    {
        ob_start();
        require("rsssl.php");
        $rsssl = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 10)
    {
        ob_start();
        require("rsszim.php");
        $rsszim = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 11)
    {
        ob_start();
        require("rssbd.php");
        $rssbd = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 12)
    {
        ob_start();
        require("rsswi.php");
        $rsswi = ob_get_contents();
        ob_end_clean();
    }
    else if($foruminfo['forumid'] == 67)
    {
        ob_start();
        require("rsswc.php");
        $rsswc = ob_get_contents();
        ob_end_clean();
    }


killerkraft 09-13-2007 04:43 PM

Thank's Mick it really works and it is very easy to implement.

Kind regards from Portugal.

KK

Dismounted 09-14-2007 10:58 AM

Cleaned and leaned a lot of Mick's code :).
PHP Code:

ob_start();

switch (
$foruminfo['forumid'])
{
    case 
3:
        require_once(
'./rsseng.php');
        
$rsseng ob_get_contents();
        break;
    case 
4:
        require_once(
'./rssaus.php');
        
$rssaus ob_get_contents();
        break;
    case 
5:
        require_once(
'./rsssaf.php');
        
$rsssaf ob_get_contents();
        break;
    case 
6:
        require_once(
'./rsspak.php');
        
$rsspak ob_get_contents();
        break;
    case 
7:
        require_once(
'./rssind.php');
        
$rssind ob_get_contents();
        break;
    case 
8:
        require_once(
'./rssnz.php');
        
$rssnz ob_get_contents();
        break;
    case 
9:
        require_once(
'./rsssl.php');
        
$rsssl ob_get_contents();
        break;
    case 
10:
        require_once(
'./rsszim.php');
        
$rsszim ob_get_contents();
        break;
    case 
11:
        require_once(
'./rssbd.php');
        
$rssbd ob_get_contents();
        break;
    case 
12:
        require_once(
'./rsswi.php');
        
$rsswi ob_get_contents();
        break;
    case 
67:
        require_once(
'./rsswc.php');
        
$rsswc ob_get_contents();
        break;
}

ob_end_clean(); 


amnesia623 09-14-2007 02:09 PM

Thank you!

MickDoneDee 03-21-2009 01:39 AM

feedkiller.com is a free online tool that allows you to merge multiple rss feeds into your own rss mix made up of your favorite feeds.

You might have to scroll down to see the online form due to poor page layout.

The first field requires you to input the name of your custom feed. For example: Australian Cricket News
Quote:

choose a name for the custom feed you are building:
The next two fields require the source feed URLs.
Quote:

enter the url for the feed you want to use:
In the stories: field the default number is 1. Change the number to however many stories you want to display from this source feed. For example, I selected 10 stories from 3 different RSS feeds so that 30 stories are displayed on my web page.

To add more than two RSS feeds to your custom feed click http://www.feedkiller.com/images/btn_add.png

When the form is done click http://www.feedkiller.com/images/btn_build.pngA new page will appear containing a link to your custom RSS feed URL. For example: http://www.feedkiller.com/feed-2083 will redirect to http://www.feedkiller.com/files/rss.php?id=2083. You may have to wait a few seconds for the redirect to happen.

Now place the second URL in your php file in the following section:

// If XLMFILE is passed as part of the URL, XMLFILE=, then it will be used
// otherwise the the file below is used.
//$XMLfilename = "http://examlple.com/sample.xml";
$XMLfilename = "http://www.feedkiller.com/files/rss.php?id=2083";

If you paste http://www.feedkiller.com/feed-2083 into the file it will create errors on your webpage.

rooban12 06-12-2009 09:51 AM

thanks


All times are GMT. The time now is 06:16 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01182 seconds
  • Memory Usage 1,827KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete