The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Latest blog in postbit - magpierss Details »» | |||||||||||||||||||||||||
For this hack, we are using magpierss - simple and GPL.
================================================== ========= MagpieRSS provides an XML-based (expat) RSS parser in PHP. MagpieRSS is compatible with RSS 0.9 through RSS 1.0. Also parses RSS 1.0's modules, RSS 2.0, and Atom. (with a few exceptions) http://magpierss.sourceforge.net/ ================================================== ========= Idea came from DigitalPoint. I have actually been using this for several months on my forum. But with the new plugin system, it's even easier to share. Install instructions: Step 1) Magpierss Download & Install: http://magpierss.sourceforge.net/ Create a "cache" directory or make sure path is ok in: MAGPIEDIR/rss_cache.inc Step 2) Create a new profile field for the Blog - Note the field# The example below is field 7. Step 3) Edit magpierss.xml 1. include your full path to magpierss/rss_fetch.inc 2. Change field 7 to applicable field. PHP Code:
Import magpierss.xml Step 5) In your postbit template add the following (note field #!): PHP Code:
Attached files: 2 Template Edits: 1 Simplicity: Easy Time: < 30 mins, 5 mins for advanced users Attached is a screen from another nevetS's Blog Feed parser using Carp - it is just as relivant. https://vborg.vbsupport.ru/showthread.php?t=91781 Show Your Support
|
Comments |
#2
|
|||
|
|||
Thanks clicked the Install .. going to check it out now.
- - - - - Edit: I can't seem to get any output after installing this plugin. I have installed MagpieRSS correctly. I created a directory called magpierss and uploaded the 4 main files along with the directory called extlib with the file Snoopy.class.inc in that directory. I then created a cache directory and set the proper permissions. Next I created the profile field which was number 7 for me. Just a basic one line text field. I then edited the xml file for the plugin and added my full path and double checked the field number which was already at 7. Then I used the plugin manager to upload the plugin xml file and it was added correctly. Then I edited my postbit template with the if statement. Now comes the problem .. the cache works fine and when I open the cache file in my editor it is reading the RSS feeds I am testing with just fine but on my post it never shows the post title or link. Anyone else have this issue or am I missing something? Example of where I have it .. maybe the placement? but the hook seems to be for the whole postbit so not sure there. http://forums.emufanatics.com/showth...=5751#post5751 - - - - - - - Edit2: I did a standalone test just using MagpieRSS .. and it works so at least I know it's not the server. .. http://forums.emufanatics.com/rsstest.php - - - - - - - Edit3: Sorry for so many edits. After checking out some of the included documentation for MagpieRSS I noticed in the recipes file they showed how to limit the number of posts to show .. so I went ahead and stuck this into the plugin and now it works perfectly for me. Here is the code I used. Code:
if ($post['field7']){ $num_items = 1; $rss = fetch_rss($post['field7']); $items = array_slice($rss->items, 0, $num_items); foreach ( $items as $item ) { $blogTitle = $item['title']; $blogLink = $item['link']; } } |
#3
|
|||
|
|||
Awesome - thanks for the catch.
I didn't limit it, in case I wanted to pull the RSS for other pages. |
#4
|
|||
|
|||
Since there's a cache I'm assuming that this doesn't mean every time showthread.php is called that it's a hit on all the feeds of that page, does it?
|
#5
|
|||
|
|||
Quote:
I have mine set on an hour. If 3 folks in the thread have blogs it could potentially be 3 hits getting feeds. |
#6
|
|||
|
|||
Meaning if there are 3 blogs then it can be up to 3 hits per hour?
Although this hack is working for me, I looked in my cache directory and it's empty. I went into a thread where I know there are a couple blog links and same story. Do you see data in your cache? Any suggestions to debug this? I'd like to test it in a way to see what error messages would come up when trying to create the cache. Just as a test I made the most lenient permissions on the cache directory yet nothing comes up. |
#7
|
|||
|
|||
I fixed it. If you don't see a file in your cache directory, that means cache isn't working for you. To debug this, open your rss_fetch.inc file.
Explicitly define the full path to your cache directory. PHP Code:
PHP Code:
PHP Code:
One more point on the hack the way it's currently put. I believe you are calling this in global.php unneccessarily. This adds an include on every single page of vbulletin. Instead of two hooks, just remove the hook to the global and stick that line require_once '/path/to/magpie/rss_fetch.inc'; in the postbit hook and it'll work fine and reduce load. |
#8
|
|||
|
|||
Sorry for the serial posts, but there is a huge problem with this hack. If a user puts in a bogus entry, any thread with that user will get a big error message passed from magpie. There needs to be a way to suppress errors.
It would also be a good idea when creating the custom profile field to get a good REGEXP to validate URLs. I'm looking for some code that will work. If you have it, please post to this thread: http://www.vbulletin.com/forum/showt...486#post943486 |
#9
|
|||
|
|||
Although I'm still missing a good regexp for url validation that works w/ vb, I did fix everything else. Here's how. Modify your plugin to look like this:
PHP Code:
|
#10
|
|||
|
|||
Quote:
PHP Code:
I tried checking for XML or RSS in the URL before it runs. So far, it appears to be working for me. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|