Results 1 to 4 of 4

Thread: Recursive RSS display

  1. #1
    Join Date
    Apr 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Recursive RSS display

    1) Script Title: Advanced RSS Ticker (Ajax invocation)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...rsstickerajax/

    3) Describe problem: I like this script a lot and it works great, but I wanted to try a different tack in using it. Rather than having multiple instances on a page, I wanted one instance that recursively goes through an array of the feeds (e.g., show CNN, then BBC, then Google, etc.).

    It's simple enough to set up an array and kind of get things going, but after the first feed, things start to go awry. I either get an unchanging "ticker initialzing" message, or it appears to move on to the next feed (my header text changes), but undefined appears in all the displayed fields.

    I did at one point apparently get it to work correctly (showing the CNN items and then the BBC stuff), but after the first full cycle, it wigged out: the messages flashed between the two feeds (apparently cycling very fast and then just stopping on a random item) before increasingly slowing down (probably some sort of memory leak).

    It seems like what I want can be done, but I'm nearing the end (maybe I'm already out) of things I can try to make this happen. If anyone's done this successfully and/or could offer some insight as to what I might try, I'd be appreciative. (I don't currently have a visible page to demonstrate my failures, but I'll try to set something up so at least my code changes could be seen.)

    Thanks!

  2. #2
    Join Date
    Apr 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Some progress to report, mostly good. I took another stab at this, and apparently got onto a path different from what I'd done before, because this one worked. At least it does in Firefox; something's up with IE, and I haven't tested Opera, Safari, et al. yet. And the changes are surprisingly simple.

    In rssticker.js, in the main rssticker_ajax function, I changed this line:
    this.RSS_id=RSS_id //Array key indicating which RSS feed to display
    to this:
    this.all_ids = RSS_id.split(",");
    this.on_id = 0;
    this.RSS_id = this.all_ids[this.on_id];


    Then, at the bottom of the rssticker_ajax.prototype.rotatemsg function, these lines:
    this.pointer=(this.pointer<this.feeditems.length-1)? this.pointer+1 : 0
    setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container every second

    were replaced with:
    if (this.pointer < this.feeditems.length - 1) {
    this.pointer++;
    setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay);
    } else {
    this.pointer = 0;
    if (this.on_id < this.all_ids.length - 1) {
    this.on_id++;
    } else {
    this.on_id=0;
    }
    this.RSS_id = this.all_ids[this.on_id];
    this.getAjaxcontent();
    }


    That's it; nothing else changes in rssticker.js, and there are no changes in the PHP files. With the above done, the instantiation in demo.htm looks like this:
    new rssticker_ajax("CNN,BBC", 1200, "ddbox", "bbcclass", 3500, "date+description")

    There are still some things to do -- like indicate the current feed name, and the above mentioned IE issue -- but this is looking a lot better than when I first posted this thread. I've attached a zip file with the modified JS code.

    If anyone has any thoughts or suggestions, or sees any huge red flags that I'm missing, please post.

    Great script; thanks to DD and the original author(s).

  3. #3
    Join Date
    Apr 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think I've gotten around the IE issue. I added "this.ajaxobj.abort()" before the new "this.getAjaxcontent()" call in the rssticker_ajax.prototype.rotatemsg function and presto! the page in IE worked just as well as in Firefox. (FF doesn't appear to be negatively impacted by this change.)

  4. #4
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot for your hard work in solving this issue... I have had the exact same issue that you encountered and I will try your fix as a manner of resolving it... thanks a bunch

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •