![]() |
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. |
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> |
Can you post the plugin?
Do you think you will upgrade to 3.6.8? |
Quote:
Quote:
Quote:
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. |
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 :) |
1 Attachment(s)
In my first post I gave you an example of code to place in your forum display template:
Quote:
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. |
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.
|
Does anyone know if it is even possible for it to be written into a product with admincp controls?
|
I would have thought it would be possible and get rid of the need to edit the tamplates?
|
If it is possible to turn this into a product/plugin I will pay to have it coded.
|
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. |
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. |
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! |
Quote:
Code:
// The variable $cacheTTL controls how many seconds a cached copy of an XML Quote:
Quote:
|
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. |
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) |
Thank's Mick it really works and it is very easy to implement.
Kind regards from Portugal. KK |
Cleaned and leaned a lot of Mick's code :).
PHP Code:
|
Thank you!
|
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:
Quote:
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. |
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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|