Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: gAjax RSS Feeds Displayer v2.1 - Atom feeds arent shown

  1. #1
    Join Date
    Jan 2017
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question gAjax RSS Feeds Displayer v2.1 - Atom feeds arent shown

    1) Script Title: gAjax RSS Feeds Displayer v2.1 (hosted)

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

    Question:

    I was use old version of gAjax RSS Feeds Displayer (that used Google's Ajax Feed API to host) and then Atom and RSS feeds worked fine. I updated the script to v2.1 (using Yahoo YQL to host) but it cant fetching ATOM feeds. I tried a few ATOM feed URLs, but diplaying only blank area, also retrieving icon doesnt seems. The script only displaying RSS feeds, but not ATOM feeds like old versions. How can i fetch and display ATOM feeds with this script?

    Thank you!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    OK, I had a heck of a time finding an atom feed to test this on. Seems a lot of them are going out of business. But if you have valid ones (test that by going direct to them in the browser to see if they show up), this may work, or it may need further tweaking. It worked on the two ATOM feeds I tested it on. Their structures were pretty different. I also studied the W3C standards for ATOM to clarify any ambiguities. First use this updated version of the script:

    gfeedfetcher.js

    The usage is the same whether you want to use ATOM or RSS or a combination of both or either, with one IMPORTANT CHANGE. If you have one or more ATOM feeds in a feed grouping (even if it's the only feed in that instance), you must add the feed type to it's instance.addFeed function, like so

    Code:
    <script type="text/javascript">
    
    var freeform=new gfeedfetcher("example2", "example2class", "")
    freeform.addFeed("Free Form", "http://www.freeke.org/ffg/index.atom", "atom") //Specify "label" plus URL to feed, optional feedtype (defaults to 'rss')
    freeform.addFeed("CSS Drive", "http://www.cssdrive.com/index.php/news/rss_2.0/") //Specify "label" plus URL to feed, optional feedtype (defaults to 'rss')
    freeform.displayoptions("date snippet") //show the specified additional fields
    freeform.setentrycontainer("li") //Display each entry as a list (li element)
    freeform.filterfeed(10, "date") //Show 10 entries, sort by date
    freeform.init() //Always call this last
    
    </script>
    Notice the highlighted.

    If you have any problems let me know. It would be helpful to have a link to your page though so I can see what's happening and can test the feeds that you're using.

    NOTE: Some ATOM feeds and some items in a given ATOM feed may use xhtml for the the description with no fallback to plain text or html. For those that do it that way I've included an experimental xhtml object parser routine (the YUI interface turns everything into objects) that's clearly marked in the script. The results it gives are not ideal, but I think they're better than no descriptions at all for those items/feeds - that is if the description field is even desired for that feed. If you would rather have no descriptions for those items, simply comment out the routine or remove it. If on the other hand you would rather have it for some feeds and not others, simply do not include descriptions at all on the ATOM feeds you don't want using it. More fine tuning is possible I suppose. Let me know of any requirements you might have there, I will also update the code if anything of value in this or any other regard strikes me.
    Last edited by jscheuer1; 01-20-2017 at 05:27 AM. Reason: code improvement to attachment
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2017
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello,
    It working now without any problems (So, i didnt see any problems).

    Many thanks for help!
    Regards.
    Last edited by esq; 01-20-2017 at 11:40 AM.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    Great work John! I'll look at possibly integrating your changes into the official build, if there's enough demand for displaying atom feeds.
    DD Admin

  5. The Following User Says Thank You to ddadmin For This Useful Post:

    jscheuer1 (01-21-2017)

  6. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    OK, great DD! Let me know because I'm still playing around with it a bit. I've already made some slight improvements to the version attached above.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Made some updates, I think you might want to switch to this new version anyway as in addition to adding ATOM and improving how that is handled over the version attached earlier in this thread, it also has some general improvements. The code is a little longer, but most likely makes up for that in efficiency/modularity. From the comments section:

    Code:
    // Unofficial update Jan 23rd, '17(jscheuer1): Add and improve capability to process ATOM feeds, routines to complete main (title)) links
    // from feeds if they're relative, more options and tweak result of limitlength()*, add linktarget to all links in a feed/feed group,
    // distribute uneven filterfeed() 'number to show' more evenly, preserve for possible subsequent inits all regex's used on fields and
    // feed added via addregexp(), (previously only regex's used on the entire feed were preserved), add feedwritten function. add test to
    // see if target div already exists allowing the initial function to be recalled on the same element, tidy up code a bit
    // -------------------------------------------------------------------
    
    /* limitlength() still works mostly as originally designed. New options - even if the entry is already short enough, all tags
    can still be stripped from the field if a third parameter is set to true, ex:
    
    instance.limitlength(175, 'descriptionfield', true)
    
    Instead of providing a number limit, one can opt for the keyword 'strip'. If one does so, the
    result is that tags are stripped from the field but no limit is imposed, ex:
    
    instance.limitlength('strip', 'descriptionfield')
    
    Also, slightly changed is that the test to see if the limit is applied is now the on screen length of the unstripped text,
    rather than the unstripped length, which it did before and if done that way could sometimes result in shorter entries
    than desired, or unecessary stripping, HTML tags* add no length to text on the screen, but do add a lot to the string
    length. By removeing them and replacing non-breaking spaces with spaces, we can get a truer screen length of the text.
    
    * other than images, no way to measure them until they load. They can be set display none or sized in style,
      or strippred separately with regex feature.
    */
    That last bit on exactly what was done to limitlength() can be removed once the demo page instructions reflect the changes. Here's the script:

    gfeedfetcher-prot.js
    Last edited by jscheuer1; 01-24-2017 at 05:02 AM. Reason: minor code improvement to attachment
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #7
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    Thanks John for the update! I'll give it a test drive this weekend.
    DD Admin

  9. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Let me know if you see any problems, should be easy to deal with. Oh, and I forgot to mention, though I hope you remember that in the addFeed function, if it's an ATOM feed, the third parameter 'atom' must still be set (as in the original attached script in this thread), ex:

    Code:
    freeform.addFeed("Babblefish", "http://bblfish.net/blog/blog.atom", "atom") //Specify "label" plus URL to feed, optional feed type (defaults to "rss" - "atom" is the other option)
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #9
    Join Date
    Aug 2004
    Posts
    10,138
    Thanks
    3
    Thanked 1,007 Times in 992 Posts
    Blog Entries
    16

    Default

    Just testing gajaxfeeder.js for compatibility with the two other scripts that use it:

    http://www.dynamicdrive.com/dynamici...xrssticker.htm
    http://www.dynamicdrive.com/dynamici...sescroller.htm

    For the date field, it's displaying as invalid date. Can you maybe shed light on why?
    DD Admin

  11. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,370
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Yes. I changed:

    Code:
    thisfeed[i].publishedDate = thisfeed[i].pubDate || thisfeed[i].publishedDate || thisfeed[i].date // try to locate date entry
    to:

    Code:
    thisfeed[i].ddpublishedDate = thisfeed[i].published || thisfeed[i].pubDate || thisfeed[i].publishedDate || thisfeed[i].date || thisfeed[i].updated // try to locate date entry
    That of course necessitated changing it everywhere else it was used in gfeedfetcher.js. But if it's used elsewhere in other functions in other scripts, as I see it is, it needs to be changed there as well. I did this because publishedDate is already a possible property of a feed, and I didn't want to overwrite it. I also did this with title (feeds[i].title is now feeds[i].dditemtitle), that won't effect how feeds with text titles are read, because you were reading title directly from the feed title without changing it. I created dditemtitle to store the text representation of titles in those ATOM feeds (as they are optionally allowed to and often do) that store their titles as objects in the YUI returned data without overwriting those. It also holds the text title from the other feeds, but as I say, those can still be accessed directly from title as well, as they currently are in the two other scripts. I can go over those two other scripts and make the changes if you like. And double check no other potential glitches from changed nomenclature exist. Most others, if any, would only arise when reading an ATOM feed that's doing something in a way that RSS feeds don't.

    I can actually change those other two scripts to make them compatible with either version of gfeedfetcher.js - so they still work with the old version and also with the new.
    Last edited by jscheuer1; 01-31-2017 at 04:22 PM. Reason: add last line
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. gAjax RSS Feeds Displayer - Edit Feeds Shown
    By dsol828 in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 08-01-2012, 07:11 PM
  2. gAjax RSS Feeds Displayer - ignore broken feeds?
    By kblm in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 05-24-2012, 10:18 PM
  3. Replies: 0
    Last Post: 09-05-2011, 09:18 AM
  4. gAjax RSS Feeds Displayer - can't display multiple feeds
    By nsbrown in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-06-2008, 08:40 AM

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
  •