PDA

View Full Version : gAjax RSS Feeds Displayer - update time?



Nightmaster
05-07-2011, 09:00 PM
1) Script Title: gAjax RSS Feeds Displayer

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm

3) Describe problem:
Hello there.

I seted this script and it works fine, but i cant see that it is updating. I still can see posts from April 30, and there is a new content on rss source.

Script url:
http://samo-opusteno.info/servisi/widget3.html
API is fine, but i cant see a way to refresh those enties?

regards.

Nightmaster
05-15-2011, 08:25 PM
Anyone please?

ddadmin
05-16-2011, 07:33 PM
The link to your page doesn't work for me. Anyhow, first thing to check is whether you're sorting the entries based on their dates, for example:


var socialfeed=new gfeedfetcher("someid", "someclass", "_new")
socialfeed.addFeed("Slashdot", "http://rss.slashdot.org/Slashdot/slashdot") //Specify "label" plus URL to RSS feed
socialfeed.addFeed("Digg", "http://digg.com/rss/index.xml") //Specify "label" plus URL to RSS feed
socialfeed.displayoptions("label datetime snippet") //show the specified additional fields
socialfeed.setentrycontainer("div") //Display each entry as a DIV
socialfeed.filterfeed(6, "date") //Show 6 entries, sort by date
socialfeed.init() //Always call this last

This will cause the latest entries to be shown first...

Nightmaster
05-17-2011, 12:52 AM
Thanks for your answer.
I guess that you tried to load page while i was working on some settings, please try again, it works now.

Code that is on that page:

var newsfeed=new gfeedfetcher("example3", "example3class", "_new")
newsfeed.addFeed("Vestidana", "http://vesti.samo-opusteno.info/category/horoskop/feed/") //Specify "label" plus URL to RSS feed
newsfeed.filterfeed(8, "date") //Show 8 entries, sort by date
newsfeed.init() //Always call this last
I guess that is ok, couse that is sorted by that as i can see.

Feed url that is used there is this (and u can see that it is different that content on html page)
http://vesti.samo-opusteno.info/category/horoskop/feed/

Nightmaster
05-19-2011, 08:01 AM
sorry, bump again.

Nightmaster
05-31-2011, 08:27 AM
Please, i still need help, update is still the same...Any suggestions would be grateful.

X-Tream
06-01-2011, 07:44 AM
Can't really help you with that code, but try SimplePie. (http://simplepie.org/)

You could also try this: http://feeds.feedburner.com/Samo-opustenoinfoHoroskop as the feed url

ddadmin
06-02-2011, 09:29 AM
Nightmaster, is your feed updated very frequently, such as a few times a day? If so the issue may simply be due to the way Google Feeds API (the backend powering this script) caching the feeds for a few hours at a time. If I view your demo page now I see entries from June 1st, and looking at your actual RSS entry, the latest are dated June 2nd 1amish. The difference between the two's dates is just a few hours, which means the script is working properly; it's displaying the latest entries not based on what you have in your RSS feed, but what Feed API has cached, which as mentioned is a few hours difference.

If your feeds are updated many times a day and you need a script that lets you control the cache period more precisely, you'll need one that parses the feed on your own server using a server side script. RSS Display Boxes (http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/index.htm) is one of such scripts.

Nightmaster
06-07-2011, 02:07 PM
Thanks for your kind answers, i will try as you suggested and i will come back with results.

regards.

Nightmaster
07-23-2011, 09:14 AM
Hello there again.
I've just go through script that you suggested and it works fine. However i would also like to use that script outside the server, on other domain, is that possible?
I tried to set full url in rssdisplaybox.js but it wont work when i set it:

var rssoutputscript="http://static.samo-opusteno.info/vesti/rssbox/main.php"


Can you please guide me to right direction in order to fix this?

Regards.

Nightmaster
11-13-2011, 10:23 PM
Bump. Can i use full URL in this script?

I didn't have so much time to deal with this problem, but i tried yesterday again, and i can't find a way to use full url.

Thanks in advice.

Dzonny

Nightmaster
12-01-2011, 03:12 PM
On the other hand, i don't know if i'm right, but when i delete all files from "cache" dir, i noticed that content is updated and new files are created inside that dir. So by deleting those files i can actually "update" content? Can i do that, and how often? I guess that i can make some kind of cronjob script to delete all files from /cache/ dir, so script will work just as i planned?

Regards.

jscheuer1
12-01-2011, 05:58 PM
Hello there again.
I've just go through script that you suggested and it works fine. However i would also like to use that script outside the server, on other domain, is that possible?
I tried to set full url in rssdisplaybox.js but it wont work when i set it:

var rssoutputscript="http://static.samo-opusteno.info/vesti/rssbox/main.php"


Can you please guide me to right direction in order to fix this?

Regards.

Because this script (RSS Display Boxes) uses AJAX to fetch the feed content from output of simplepie.inc and the PHP files, it cannot work cross domain. A major rewrite would be required. There are other scripts that use PHP alone to fetch the content. One is:

http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/index.htm

But it has problems as the interface it uses (LastRSS not simplepie) has problems with UTF-8. But if that isn't an issue . . . Or I have an unofficial update of it that uses simplepie.

If you reallly like RSS Display Boxes it could be adapted, but that would probably take some time.

As to your question about deleting the cache files, you could do a cron job on that I suppose. But there is a setting somewhere that regulates how long items are cached, and even if they're cached at all.

At the beginning of main.php we have:


<?php
//Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com

require('../simplepie/bak/simplepie.inc'); //Specify path to simplepie.inc on your server (by default located inside "simplepie" directory)
$feed = new SimplePie();
$feed->cache_location('cache'); //Specify path to cache directory on your server relative to this file
$feed->handle_content_type();

You could add:


<?php
//Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com

require('../simplepie/bak/simplepie.inc'); //Specify path to simplepie.inc on your server (by default located inside "simplepie" directory)
$feed = new SimplePie();
$feed->cache_location('cache'); //Specify path to cache directory on your server relative to this file
$feed->enable_cache(false); //Specify caching true/false (unquoted)
$feed->handle_content_type();

or:


<?php
//Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com

require('../simplepie/bak/simplepie.inc'); //Specify path to simplepie.inc on your server (by default located inside "simplepie" directory)
$feed = new SimplePie();
$feed->cache_location('cache'); //Specify path to cache directory on your server relative to this file
$feed->max_minutes(10); //Specify cache time in minutes (unquoted number)
$feed->handle_content_type();

Not performing at least minimal caching could result in an inordinate number of requests to the feed server.

Nightmaster
12-01-2011, 08:51 PM
Thank you very much for your answer.

In Pausing RSS Scroller script there is this code in scrollbridge.php:

$rss->cache_max_minutes(1800); //Global cache time before fetching RSS feed again, in seconds.
I can change that to something else, for example 1000 seconds? I think that even now when update time is 1800 (or 30 minutes) my feed is not updated every 30 minutes, as i can see manu new feeds on site that is not in script though.


I would love to see your version of script (rss pause scroller) if that's possible, as i need cross domain script and utf8 as well.

Regards.

jscheuer1
12-02-2011, 01:18 AM
You understand that the Pausing RSS scroller is a slightly different format for the user as far as how it appears on the page than the RSS Box script, right?

With that understanding, here's my simplepie version of Pausing RSS scroller:

4237

The only thing you have to change in it for syndication (cross domain use), as far as I know is in the rsspausescroller.js file:


/*
======================================================================
Pausing RSS scroller JavaScript engine- Dynamic Drive (http://www.dynamicdrive.com)
Docs: http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/
Last modified: March 16th, 2006.
======================================================================
*/

//URL to "scrollerbridge.php" on your server (use absolute path for syndication):
var bridgepath="simplepie/scrollerbridge.php"

//Advanced users: Edit below function to format the RSS feed output as desired
//formatrssmessage(divid, message_index_within_array, linktarget, logicswitch)

The scrollerbridge.php file has some stuff you might want to modify:


// Create simplepie object
$rss = new SimplePie();
$rss->cache_location('cache'); //path to cache directory on your server relative to scrollerbridge.php. Chmod 777!
$rss->date_format = 'M d, Y g:i:s A'; //date format of RSS item. See PHP date() function for possible input.
$rss->cache_max_minutes(30); //Global cache time before fetching RSS feed again, in minutes.
$allowtags = '<p><a><img>'; //tags to allow in items

And some you need to:


// Define your list of RSS URLs- "RSS_id"=> "URL to RSS feed"
$rsslist=array(
"test" => "http://vesti.samo-opusteno.info/feed/",
"cnn" => "http://rss.cnn.com/rss/cnn_topstories.rss",
"bbc" => "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",
"news.com" => "http://news.com.com/2547-1_3-0-5.xml",
"slashdot" => "http://rss.slashdot.org/Slashdot/slashdot",
"dynamicdrive" => "http://www.dynamicdrive.com/export.php?type=new" //<-- No comma after last entry
);

The latter are just like as documented for the LastRSS version of this script on DD, as are the configuration options for the on page call, styles, etc.

Any questions, let me know.

As a side note, I recently adapted the script to do a horizontal crawl. I have that up here:

http://www.jscheuer1.comli.com/rsscrawler/simple_ticker_demo.htm

But that site is brand new and although I will probably be keeping that demo in that location, as I work on the site as a whole, it may be temporarily unavailable at times. I may move it a little deeper in though, like as a child of a demos folder.

Also, at some point I may spring for my own domain. But for now it should be there.