PDA

View Full Version : RSS Feeds on Forumhome and Other vb Pages


tgmorris
01-13-2006, 10:00 PM
This product adds support for displaying RSS feeds on 1 or more vb pages.

The product will create 5 plugins and a new section, RSS Feed Processing, under vBulletin Options. Also added will be 2 new templates appropriately grouped under 'RSS Feed Templates'.

Configuration

Change the settings in 'vBulletin Options -> RSS Feed Processing' to suit your particular needs.

One thing that proves difficult for some users is creating the 'cache' directory. This directory needs to be CHMOD 777 and it should reside outside the web root. All of the RSS feeds will be cached in that location so depending on how the product is configured (i.e. allowing users to define their own feeds) the size of the directory could grow signficantly.

An advanced feature that is only available for non-user specified feeds is the ability to include code to filter and/or modify the feed content. If the feeds are being provided for your users this can prove to be a very powerful tool.

Placing the content on pages

As supplied the RSS Feed content will be displayed below the "What's Going On" block. This may be changed by modifying the 'RSS Feed - Content Generation' plugin in different ways.


Find where you want the output in the FORUMHOME template and change the search sttring accordingly.
Delete all the search-related text and manually edit the template(s) where you want the content to appear.

In either a) or b) above you may also change the hook location for the 'RSS Feed - Content Generation' plugin so it runs where it's needed. If the content is desired on multiple vb pages then the plugin could be moved to init_startup so long as the template edit logic is removed.

The RSS feed content is placed in the $feedcontent array with an entry for each feed. To manually place the feeds in templates refer to the entries for 3 feeds as $feedcontent[0], $feedcontent[1] and $feedcontent[2]. If the content for a given feed cannot be decoded then that array entry will be empty.

Revisions

1.00 RC2 16-Jan-2006
Added support to allow the displayed feeds to collapse when not a user-specified feed.

Modified the rss_feed_rss template
Updated the RSS Feed - Function plugin



If you find this product useful donations via PayPal may be made via the Sponsors Page (http://www.babblers.org/index.php?pg=sponsors).

Do not reproduce or publish elsewhere without my written permission.

sensimilla
01-14-2006, 08:07 PM
sounds great :) thanks

gael11
01-15-2006, 06:43 AM
Hello, great hack, it works very well ant it's very usefull ;)
But I have a question: the content is displaying in the botom of the page, how can I display a the top ? Is it in the forum home template ?
Thanks for your answers ;)

tgmorris
01-15-2006, 07:11 AM
The placement is currently determined by the RSS Feed - Content Generation plugin, the content of which is shown below.

rss_feed_processing(RSS_FEED_FIELD, RSS_FEED_USAGE);

$search_text = '<!-- end what\'s going on box -->';
$insert_text = '';
for($insertc = 0; $insertc < count($feedcontent);)
{
$insert_text .= '$feedcontent['.$insertc++.']<br />';
}
$vbulletin->templatecache['FORUMHOME'] = str_replace($search_text,$search_text.$insert_text ,$vbulletin->templatecache['FORUMHOME']);
To have the rss content appear at the top of the forumhome page the easiest thing to do is to change the search text from <!-- end what\'s going on box --> to <!-- main -->

Alternatively, you may delete all the search/replace logic in the plugin and edit the template directly by following the guidelines in the Placing the content on pages section.

Viks
01-17-2006, 02:01 AM
Hi TGmorris,

IF I would like to display the RSS feed in some other location on my forums or lets say within another template on my forum in that case

1. Could you tell me what code do I need to add to have the feeds show up there.

2. My Second question is related to the above, what part of the code do I need to remove in the XML file (provided in the zip) in order to remove the feeds to show up in forumshome.

----

Thanks for your help.

regards,

Vik

tgmorris
01-17-2006, 02:09 AM
There are several ways to accomplish what you want to do. The simplest is to edit the 'RSS Feed - Content Generation' plugin and move it to a different location (i.e. change the hook location). Once that's done edit the search text to what is needed for the new spot. This can be done by looking at the generated html and finding the appropriate comment or some unique text.

MSC
01-24-2006, 12:22 AM
Just installed this and now get the following error:

Fatal error: file_put_contents cannot write in file. in /includes/init.php(292) : eval()'d code on line 91

I tried de-activating the plugin but still get the error.

tgmorris
01-24-2006, 12:59 AM
I tried de-activating the plugin but still get the error.Did you deactivate all of the product or just some of the plugins?

If you've deactivated the plugin code in the init_startup section I'm not really sure how you can still get that error.

Any additional info you can provide will be helpful.

PS - The error message likely relates to that fact that the cache directory doesn't have 777 permissions.

GamerJunk.net
01-27-2006, 07:21 PM
This is a great plug in....

Yet I can't get it to display in my right sidebar...even with editing the search text to be right where I want it...

tgmorris
01-27-2006, 07:38 PM
This is a great plug in....

Yet I can't get it to display in my right sidebar...even with editing the search text to be right where I want it...As a test you might remove the search/replace bit and just modify the template directly. Also, make sure that the variable is available on the page you have the right side-bar.

GamerJunk.net
01-27-2006, 07:39 PM
Nevermind I got it working

noreturn
02-10-2006, 08:00 PM
can some one tell me what I am doing wrong?

My test board is located public_html/test.

I only get these errors back and never get it to work.


Warning: file_get_contents( http://scripts.ign.com/rss/ign.all.2.0.xml): failed to open stream: No such file or directory in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents( http://www.dreamstation.cc/rss/dreamstationcc.xml): failed to open stream: No such file or directory in /includes/init.php(292) : eval()'d code on line 218

Thanks All

tgmorris
02-10-2006, 09:46 PM
can some one tell me what I am doing wrong?

My test board is located public_html/test.l
Check to make sure your cache directory has the correct permissions (chmod 777) and that the path is correct.

EricaJoy
02-10-2006, 09:52 PM
hey i totally missed this when it was first posted. thanks!

dethfire
02-11-2006, 05:02 AM
how do we limit the descriptions to say 100 characters and then add (...)?

EricaJoy
02-11-2006, 04:15 PM
this definitely great! word of the day is already up and running on my board. a question though, is it possible to have the user defined rss show up on the users profile page (MEMBERINFO template)?

iambic
04-16-2006, 11:31 PM
Installed without problems, left all settings as their defaults, added an rss feed, which is cached correctly in the cache folder, but nothing gets generated in my forum's home page at http://support.iambic.com/forum/

ideas?

- Adriano

tgmorris
04-17-2006, 12:27 AM
Installed without problems, left all settings as their defaults, added an rss feed, which is cached correctly in the cache folder, but nothing gets generated in my forum's home page at http://support.iambic.com/forum/

ideas?

- Adriano
Double check to make sure the plugins are all active. Other than that you might manually edit the template as a test to see if the $feedcontent array is being populated.

The other possibility is that the feed, although cached, can't be processed for some reason. This will also cause the symptoms you are seeing.

What's the feed url you are using?

iambic
04-17-2006, 08:45 PM
thanks Tom for the quick reply -- looks like it didn't like much the atom feed, while with the RSS feed works fine.

I was trying to use the following without luck:
http://www.iampowered.com/atom.xml

so I switched to this one instead
http://www.iampowered.com/index.xml

perhaps the plugin doesn't currently support atom feeds... I should have double checked the infos above first :)

- Adriano

silly rabbit
04-20-2006, 11:27 PM
Check to make sure your cache directory has the correct permissions (chmod 777) and that the path is correct.

tg, great hack. For whatever reason however it is only working intermittently for me. Sometimes fine (often have to do a 'refresh') and sometimes no - FORUMHOME page completely fails to load. I know it's rss hack related. When working I noticed display alternates with each 'refresh'. (gone - displayed - gone - etc . . .???)

Note: I know I have one issue with '777' permissions as my server only allows '755' max but appears to working(albeit intermittently) nonetheless.

See explaination from hosting company: Implementation of PHPsuexec (http://www.surmunity.com/showpost.php?p=140626&postcount=1).

When you say 'outside the web root' do you mean anywhere except alongside 'public_html'??

thx!! Rabbit

tgmorris
04-21-2006, 01:58 AM
See explaination from hosting company: Implementation of PHPsuexec (http://www.surmunity.com/showpost.php?p=140626&postcount=1).Based on the writeup the hosting company provides it seems like it should work fine.

When you say 'outside the web root' do you mean anywhere except alongside 'public_html'??Yes, it should just not be in a folder that users can get to via the web. Although with the way the host has things set up now that's not as important.

If you aren't getting any errors generated and the file cache is being populated then it *should* be working ok. The one possibility is that the way it's currently coded if the remote site is slow to respond then the the script will be slow to fill in the data. This gets magnified as it does 3 retries when fetching things. You might try reducing the retry count from 3 to 1 to see if that helps. You can tell if this is the problem by just waiting to see if the page eventually loads.

silly rabbit
04-23-2006, 09:48 AM
Based on the writeup the hosting company provides it seems like it should work fine.
tg, once again great hack, thank you! I suspect my server is one of the last to be 'converted' and on '777' working fine. When it 'crashes' that will be my signal to drop to '755' hehe! Left cache 'alongside' web root (which is not public accessible) and will play with the 'retries'. Selecting different xml feeds does seem to make a difference on performance so I suspect your excellent coding is not to blame at all . . . .

I see where my running tally of all past and present xml feeds in the cache dir are stored as '644' which, with the exception of 'user' write(no execute), is strictly read only . . . .

Now on to modifying 'postbit'!!! Will attempt to add 'reply' links into the xml title bar which will quickly point, take reader directly to the appropriate 'comment' forum . . .

Thanks For Sharing Great Hack & reply, I think a really short 'support thread' is testament to a hack that works correct the first time and I will watch for your future / past 'inventions'!! Rss stands for 'really stupid simple'??? (hehe)

Rabbit

p.s. Everybody knows about iespell (www.iespell.com)?? Little abc/check box upper right in VB editor??? Love it! Works just fine!!

rollo tamasi
07-23-2006, 01:24 AM
how do we limit the descriptions to say 100 characters and then add (...)?

^ just wondering if the above is possible?

great mod, i was about to install feed2js with magpie and add a table below the what's going on section but i don't have to now :D

Thanks

Foxsake
07-23-2006, 07:07 AM
Installed this and created a directory outside public_hmtl
changed its permissions to 777
however each time i provide a url link it just gives this


Fatal error: file_put_contents cannot write in file. in /includes/init.php(292) : eval()'d code on line 91

can someone advise on what im doing wrong? :confused:

Thanks in advance for any help

dethfire
09-13-2006, 06:00 PM
does this work in 3.6?

dethfire
10-12-2006, 01:46 PM
anyone get this to work in 3.6?

BamaStangGuy
10-18-2006, 10:29 PM
I have this working in 3.6.2

This is a great hack but is a bit limiting.

I would like to limit title's to xx characters and be able to define how many feeds it lists per feed url I add.

tgmorris
10-18-2006, 11:32 PM
I have this working in 3.6.2

This is a great hack but is a bit limiting.

I would like to limit title's to xx characters and be able to define how many feeds it lists per feed url I add.Limiting the Title Length is easy and exactly why the Data modification code box exists. Just add the code needed to trim the titles however you would like them. As a very brief example to trim it to 10 chars...

$rss_item['TITLE'] = substr($rss_item['TITLE'], 0, 10);
Limiting the number of items on a per feed basis would require a small code change but if you know php it wouldn't be too hard to pull off.

BamaStangGuy
10-22-2006, 05:15 AM
Thank you for that.

Is there any reason that sometimes the RSS feed will not load? It seems for me that every few refreshes the rss feed does not show up.

Maybe you can reproduce it on one of my sites: Mustang Forums (http://www.mustangevolution.com/forum/)

If it shows up close the browser and open it again. If you do it a couple of times you should catch it where it won't load.

dethfire
10-26-2006, 08:43 PM
All of a sudden I'm getting these errors

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.sciam.com/xml/sciam.xml) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.sciam.com/xml/sciam.xml) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.sciam.com/xml/sciam.xml) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.sciam.com/xml/sciam.xml) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.nasa.gov/rss/breaking_news.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.nasa.gov/rss/breaking_news.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.nasa.gov/rss/breaking_news.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.nasa.gov/rss/breaking_news.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.physicsforums.com/blog/wp-rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.physicsforums.com/blog/wp-rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.physicsforums.com/blog/wp-rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.physicsforums.com/blog/wp-rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.jwz.org/cheesegrater/RSS/apod.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.jwz.org/cheesegrater/RSS/apod.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.jwz.org/cheesegrater/RSS/apod.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://www.jwz.org/cheesegrater/RSS/apod.rss) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://physicspost.com/rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://physicspost.com/rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://physicspost.com/rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /includes/init.php(292) : eval()'d code on line 218

Warning: file_get_contents(http://physicspost.com/rss.php) [function.file-get-contents]: failed to open stream: Connection refused in /includes/init.php(292) : eval()'d code on line 218

dinodonk
07-06-2007, 06:04 AM
how to remove category?
I got this feed :
<comments>http://www.mydomain.com/comments</comments>
<category domain="http://www.mydomain.com/cat1">cat1</category>
<category domain="http://www.mydomain.com/cat2">cat2</category>
<pubDate>Fri, 06 Jul 2007 01:21:08 -0500</pubDate>
<dc:creator>author</dc:creator>

thanks

dinodonk
07-06-2007, 09:51 AM
is there any performance issue with this mods? i get high load upto 3 usually only 1

is it using cache mechanism when processing the feed?

tgmorris
07-06-2007, 02:32 PM
is there any performance issue with this mods? i get high load upto 3 usually only 1

is it using cache mechanism when processing the feed?
Yes, it does create a cache file for each feed used. How long the cache is used depends on the settings for the feed (via the TTL record) as well as the configuration if there's no TTL record.

As to you other question can you please explain a bit more as to what you want to do> If you simply don't want the item category to show then the category may be deleted by using the Data Modification section.

dreamygirl
01-13-2008, 07:07 PM
Figured it out.

silly rabbit
02-21-2008, 06:05 PM
IF I would like to display the RSS feed in some other location on my forums . . . Vik
Update! Not really . . . finally got around to switching the feed off of the FORUMHOME page and it was easier than you think. The only changes made were in a very short section of the XML php itself and it now displays in my "SubForum" #1 which is a "category" comprised of other subforums (with no thread views being listed) . . .

I am running 3.6.2.

<plugin active="1">
<title>RSS Feed - Content Generation</title>
<hookname>forumdisplay_complete</hookname>
// changed from forumhome_complete**
<phpcode><![CDATA[rss_feed_processing(RSS_FEED_FIELD, RSS_FEED_USAGE);
if ($forumid == 1)
{
// conditional added (display one subcategory only) **
$search_text = '<!-- / forum rules & forum jump -->';
// new searched text located bottom of FORUMDISPLAY template **
$insert_text = '';
for($insertc = 0; $insertc < count($feedcontent);)
{
$insert_text .= '$feedcontent['.$insertc++.']<br />';
}
$vbulletin->templatecache['FORUMDISPLAY'] = str_replace ($search_text,$search_text.$insert_text,$vbulletin->templatecache['FORUMDISPLAY']);]]>
}
// end "if" condition (make whatever you want!) - both refs above were FORUMHOME **
</phpcode>
The hook, search and displaying works and behaves as originally coded, make sure you check "overwrite" when reinstalling and that is it!

Thx Again. Rabbit

dethfire
08-18-2010, 01:13 AM
i upgraded to php 5.2.14 and now some feeds don't display. any ideas?

valdet
07-22-2013, 11:45 AM
Hi,
I know it's an old thread but hopefully someone can help.

I added $feedcontent[0] inside a custom template (usc_sidecolumn_right from this hack Ultimate Side Column by Peterska (https://vborg.vbsupport.ru/showthread.php?t=141870)) but the feeds do not show up.

I made the proper replacements in the plugin search string but no such luck so far.

For testing purposes, I added the same text in forumhome and the rss feeds showed up correctly.

Is there something that needs to be done in order for $feedcontent[0] to display in other templates other than main ones.

I am on vB 3.8.7

Thanks,