UBB.Dev
Posted By: Gardener [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 4:19 AM
I needed newsfeeds now so I wrote a small simple pal to take a list of RSS files and show the content.

Just download the zip file and unzip it into your pals directory.
Rename the file newsfeedpal.php to the first empty customboxXpal.php file and set the number you chose in the $forumlistcustombox variable.
Create a directory called "newsfeeds" (for RSS file caching) in your pals directory and give the web server write permissions to it:

> chmod 777 newsfeeds

The script will show the latest info from Slashdot.org and freshmeat.net if you don't change anything, there is a list of a few other feeds you can use in the script. Some more can be found at this site: http://www.syndic8.com

This pal is written for IIP 5.3, but might work with earlier IIP 5.x versions, it even defaults to some own table wrappers if threads doesn't have any.

Attached File
71390-newsfeedpal-1_0.zip  (27 downloads)
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 5:00 AM
Updated the script with the ability to select if image and text input should be shown with each newsfeed. The new version is attached to the first post of this thread.
Posted By: AllenAyres Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 5:28 AM
thanks Gardener, these are becoming very popular
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 5:44 AM
Yes, it's a nice way to add content to your site, and if you publish your own RSS file to get traffix. Unfortunately I've only found two interesting in Swedish. =/ One is very good though, Gnuheter, which is Gnu news sort of, and from DN, the biggest morning news paper in Sweden.

I've done another small update, if only one feed is entered, it shows the title of the feed in the header of the pal instead of inside it. I've updated the zip in the first post of this thread.
Posted By: Dalantech Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 6:37 PM
If I only chose one news feed, then the table confoms to the size limits I've set in the admin section of IIP. With multiple news feeds the table almost doubles in width.

Edit: Macslash was causing the table to be too wide. The took thinking different just a little too far for me

Very mod BTW!
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 7:07 PM
Just took a look at your site, it looks good. =] It might be a bit too much text though, unfortunately the rdf class I used doesn't seem to offer any options on how to display the content, it's all or nothing more or less.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 8:17 PM
problem with this. Maybe I am not understanding the directions. You create a directory under pals named newsfeeds and change mode to 777. You rename the newfeedpal.php to your first empty custombox3.php ( in my case the first open one ) set the variable to the number inside etc etc. Upload the two files into the pal directory and then place it where you want via IIP config. well the entrance page does not load on my test site when it gets to the newsfeed?

http://www.reeftalk/beta/
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 8:34 PM
That's strange. You seem to have followed the instructions correctly, but it seems that the page just dies when the pal is loaded... I know I had problems on my home computer because of the flush() function not seeming to work on Apache 2+PHP. But that resulted in garbage showing, not stopping the page. You could try editing rdf.class.php and comment out the line that says flush() in the function finish() but that shouldn't be a problem really.

What newsfeeds are you using, could you possibly paste in the config part of your script?
Posted By: Dalantech Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 8:43 PM
The lenght of the text is OK for me since it's the last pal box to load on the page.

Well done Gardener!
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 8:46 PM
Commenting out the flush() did not work and here are the variables

// ************************************************************************* //
// Start of editable variables

// Select which Custom Box you use this pal as (can be 1-6):
$forumlistcustombox = 3;

// The number of items to get from each feed
$feeds = 3;

// An array containing links to the rss feeds you want to show.
$newsfeeds = array(
"Wired News" => "http://www.wired.com/news_drop/netcenter/netcenter.rdf",
);

// Seconds between updating of cached rss file.
$feed_refresh = 3600;

// Show image in newsfeed (true or false)
$feed_image = true;

// Show text input field in newsfeed (true or false)
$feed_textinput = false;

// End of editable variables
// ************************************************************************* //
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 9:17 PM
Strange. I copied your config to my local script and it turns out just fine.

What version of PHP are you using? And what webserver?

Try finding this line:
$cbstorage = $TempStorage;

And add the following debug output after it:
echo $TempStorage;

I'm not really sure what could be wrong. Do you have access to the web servers error log? If you could take a look into it and see if it says something it would be great.

The script is saved in DOS format for some reason (probably is in the original customboxpals), maybe you could try and save it in unix format?
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 9:23 PM
Yeah, and you have a lot of your own articles as well, it looks more obtrusive at my site, especially since the one I use has very long summaries.
Posted By: salim Re: [IIP 5.3] RSS News Feed pal 1.0 *DELETED* - 03/01/2003 10:47 PM
Can you show me a site that uses this news feed
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/01/2003 10:49 PM
The one I use is in Swedish, but you can see how it works at Dalentechs site: http://www.dalantech.com/

You will find the newsfeed at the bottom of the left column.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 2:18 PM
Gardener,

I tried the echo tempstorage but nothing changes. This gets hung as usual. PHP version 4.1.2
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 4:38 PM
Is anything written into the newsfeeds directory?

Do you get any errors in your server log?

Could you add some debug output in a few places to track down where it stops?

I've only tried this on PHP 4.2.2 and PHP 4.3.0. Hmm. Could you run the phpinfo() function and check that xml support is active?
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 4:42 PM
I always have a problem viewing server log it never loads. However XML is active. There is nothing written in the newsfeed directory. It is 777. I added the echo statement where you told me. This hack is dieing before that point it seems.

XML

EXPAT Version 1.95.2

server info

Linux dev.host4u.net 2.2.19 #6 SMP Fri Apr 6 02:20:07 CDT 2001 i686 unknown
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 4:58 PM
OK, so you have XML at least, so it isn't that. Now I'm stumped...

Try adding some more debug output.

Find this:
Code
<br />// Include the RDF class<br />require_once("rdf.class.php");<br />

And add this below:
Code
<br />echo "rdf class loaded<br />";<br />


Find this:
Code
<br />// Check and see if we need update cache<br />if ((!$LastCacheTime) || (!$cbdata) || ($LastCacheTime < ($date - ($cbcache * 60)))) {<br />

And replace it with this:
Code
<br />echo "LastCacheTime: $LastCacheTime, cbdata: $cbdata, date: $date, cbcache = $cbcache<br />";<br />// Check and see if we need update cache<br />if ((!$LastCacheTime) || (!$cbdata) || ($LastCacheTime < ($date - ($cbcache * 60)))) {<br />echo "Updating cache...<br />";<br />


Find this:
Code
<br />    // Set some initial variables for the RDF object.<br />    $rdf = new fase4_rdf;<br />

Add this below:
Code
<br />echo "Created the rdf object...<br />";<br />


Find this:
Code
<br />    foreach ( $newsfeeds as $feed_title => $feed_url ) {<br />

And add this below:
Code
<br />echo "Reading newsfeed '$feed_title'...<br />";<br />
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 5:19 PM
With all that debug info still the same nothing displays on screen and same result

http://www.reeftalk.com/beta/index.php

Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 5:26 PM
OK, so it must be that the rdf class include for some reason stops the script, it really shouldn't be able to though, since it in itself does absolutely nothing.

Try adding this:
Code
<br />echo "Going to load rdf class now...<br />";<br />

Above this:
Code
<br />// Include the RDF class<br />require_once("rdf.class.php");<br /><br />echo "rdf class loaded<br />";<br />


Just to make sure it is actually when loading the class and not for some other reason it dies...
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 5:33 PM
Yep thats whats happening.

Now I see Going to load rdf class now

At least we are starting to get somewhere.
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 6:37 PM
Try adding debug output at the top and bottom of the rdf.class.php script and see if it actually gets loaded.

You could possibly try and raising the error reporting level in the newsfeedpal script before the rdf class is loaded.

Find this:
Code
 <br />// Include the RDF class <br />require_once("rdf.class.php"); <br />

Replace it with this:
Code
 <br />// Include the RDF class <br />error_reporting(15); <br />require_once("rdf.class.php"); <br />


Then find this:
Code
 <br />    default: $CustomBox1StorageString = $cbstorage; break; <br />} <br />

And add this below:
Code
 <br />error_reporting(7); <br />


It will report some notices about undefined values, which is OK. But if you could paste all error messages that would be a help.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 7:31 PM
Well with all the debug info from before all I got was loading the rdf file

Now I took a clean newsfeedpal.php file and added the code above and I get the same exact thing as with no debug. Just stops loading.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 7:32 PM
None of the debug or error reporting brings back any errors.
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 8:24 PM
I made a small change to my earlier post, at first I had the error_reporting(7) right below the require, but it should go at the end of the newsfeedpal.php script.

It doesn't give any error at all? That is very weird.

Is the permissions correct for rdf.class.php? Is it readable by the web server?

Did you get any output when putting in an echo statement at the top of rdf.class.php? If you don't that script isn't loaded at all...
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 9:05 PM
Here is what you posted and I followed

// Include the RDF class
require_once("rdf.class.php");


--------------------------------------------------------------------------------

Replace it with this:
Code:
--------------------------------------------------------------------------------

// Include the RDF class
error_reporting(15);
require_once("rdf.class.php");


--------------------------------------------------------------------------------


Then find this:
Code:
--------------------------------------------------------------------------------

default: $CustomBox1StorageString = $cbstorage; break;
}


--------------------------------------------------------------------------------

And add this below:
Code:
--------------------------------------------------------------------------------

error_reporting(7);

Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 9:32 PM
Well then, it seems that there is no error, what you see is what you get! =]

If something happens in the script it really should report an error... I have absolutely no idea on what the problem is.

Let's add som debug code to rdf.class.php, use the one I've attached to this post instead, just rename it from .txt to .php.

Attached File
71594-rdf.class.txt  (20 downloads)
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 9:41 PM
Nope nothing with that either. I mean the web server allows xml. There is not error but then the box is not displayed. Now if there was indeed not an error would not the table display. It seems it is choking before anything happens.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 9:41 PM
Nope nothing with that either. I mean the web server allows xml. There is not error but then the box is not displayed. Now if there was indeed not an error would not the table display. It seems it is choking before anything happens.
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 10:03 PM
Well, the first thing rdf.class.php does now is printing something, so it can't possibly be executed.

Have you been able to get any debug output at all from the newsfeedpal.php script?

Does that script have the right permission for the webserver to read it?

Try adding "error_reporting(15);" to index.php (the iip script) below the following:
Code
<br />	$html -> send_header($config['title'],$Cat,0,$user);<br />	list($tbopen,$tbclose) = $html -> table_wrapper();<br />
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 10:23 PM
I get nothing from the debugging before and I get nothing printed with clean file and your version of rdf.class.php. That tells me that the problem is before this file? It should print your echo line in the rdf file but instead nothing but hang. I put the error_reporting line in index.php and it spits out errors for the pal boxes that load and the page stops when it gets to where the custombox3pal.php box is suppose to load.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 10:24 PM
I get nothing from the debugging before and I get nothing printed with clean file and your version of rdf.class.php. That tells me that the problem is before this file? It should print your echo line in the rdf file but instead nothing but hang. I put the error_reporting line in index.php and it spits out errors for the pal boxes that load and the page stops when it gets to where the custombox3pal.php box is suppose to load.

Everything has write permission from the server.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 10:29 PM
I solved it. Funny thing is the line require_once("rdf.class.php"); You meantioned nothing about setting the full path to the file. I figured since it was in the same directory that it would find it. I set the full path and it works.
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 10:30 PM
I just loaded your beta site and it works, with the newsfeed. What did you do?
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 10:41 PM
Hmm. That means you don't have the current directory in your php include path. But even so, I thought you should have gotten an error if it didn't find the file, but apparently not, that requires even higher error level. Oh well, at least I've learned something.

I'll add the path to the script and update the first post. Thanks for finding that nasty little bug.
Posted By: Gardener Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 10:46 PM
I've updated the attachment in the first post of this thread with a slightly updated script that takes care of some small bugs. If the script works for you there is no need to update. Thanks goes to Omegatron for finding one of the bugs and the fix for it.
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/02/2003 11:24 PM
Well I do not know what PHP include path is set at since this is not my server. Whats weird is Threads works fine but that is why one specifies in MAIN.INC.PHP the path to Threads directory so one can just put require in the("main.inc.php"); and it loads ubbt.inc.php

I guess some servers always require a PATH defined. I thought I too would have gotten an error.
Posted By: salim Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/03/2003 12:45 AM
Maybe I dont understand this. But I tried installing a pal box yesteday to mysite as per gardner instruction and it worked fine.

Now I was wondering, if the case only adding an html code after the <<COMMENT code. Than why not adding the html code one normally get from those news feed site and placing it as if your placing a normal html code. Than that I think should work exactly the same and get the NEWS FEED accordingly and placing it in the pal box of your choice. OR AM I MISSING SOMETHING
Posted By: omegatron Re: [IIP 5.3] RSS News Feed pal 1.0 - 03/03/2003 12:50 AM
It is XML not HTML
© UBB.Developers