Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.
Attachments
71390-newsfeedpal-1_0.zip (0 Bytes, 27 downloads)

Last edited by Gardener; 03/02/2003 3:44 PM.
Sponsored Links
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
thanks Gardener, these are becoming very popular


- Allen wavey
- What Drives You?
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
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!

Last edited by Dalantech; 03/01/2003 11:47 AM.
Sponsored Links
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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/

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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?

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
The lenght of the text is OK for me since it's the last pal box to load on the page.

Well done Gardener!

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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
// ************************************************************************* //

Sponsored Links
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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?

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: Feb 2003
Posts: 196
Member
Member
Offline
Joined: Feb 2003
Posts: 196
Can you show me a site that uses this news feed

Last edited by salim; 03/01/2003 3:50 PM.
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Gardener,

I tried the echo tempstorage but nothing changes. This gets hung as usual. PHP version 4.1.2

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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?

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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 />

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
With all that debug info still the same nothing displays on screen and same result

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


Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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...

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Yep thats whats happening.

Now I see Going to load rdf class now

At least we are starting to get somewhere.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Last edited by Gardener; 03/02/2003 11:45 AM.
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
None of the debug or error reporting brings back any errors.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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...

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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);


Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.
Attachments
71594-rdf.class.txt (0 Bytes, 20 downloads)

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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 />

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
I just loaded your beta site and it works, with the newsfeed. What did you do?

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
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.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
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.

Joined: Feb 2003
Posts: 196
Member
Member
Offline
Joined: Feb 2003
Posts: 196
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

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
It is XML not HTML


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)