Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: gAjax RSS Pausing Scroller Date/Time function

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

    Default gAjax RSS Pausing Scroller Date/Time function

    1) Script Title: gAjax RSS Pausing Scroller (hosted)

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

    3) Describe problem: Date/time is dumb

    Hi all

    After developing and integrating this script on my site, I've found that the only glitch to this awesome little tool is that the date/time function displays incorrectly. By that - I mean, the dates I am inputting show up as the next day! So I am assuming somewhere it is referencing the US timezone, seeing as it's hosted by Google. Is that correct? If so, is there any way of specifying our timezone, in Australia, as well as modifying the properties of the date display so it displays as 10:00am instead of 1:00:00...

    Many thanks for all your assistance

    Mrs Spence

  2. #2
    Join Date
    Aug 2004
    Posts
    9,910
    Thanks
    3
    Thanked 969 Times in 957 Posts
    Blog Entries
    15

    Default

    The only description I found from Google's doc on the RSS date format:

    publishedDate: The string date on which the entry was published of the form "13 Apr 2007 12:40:07 -0700". You can parse the date with new Date(entry.date). Corresponds to the <published> element in Atom and the <pubDate> element in RSS.
    You may want to look into all the valid syntax for the pubDate element in RSS. I believe you may be able to specify timezone and other info within it.

  3. #3
    Join Date
    Feb 2006
    Posts
    230
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Default

    I think something else is wrong. If I do a search in google news and save it as a bookmark, it gives me a list of links, however when the rss link is used in this scroller, only the first item appears. With yahoo and others, multiple links appear in the scroller. So, I assume that the error is in the DD scroller.

  4. #4
    Join Date
    Aug 2004
    Posts
    9,910
    Thanks
    3
    Thanked 969 Times in 957 Posts
    Blog Entries
    15

    Default

    Do you mean a RSS feed based on a Google search result? Do you have a sample RSS feed URL?

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

    Default

    HI DDadmin,

    Do you have the link to this info by any chance?

    Many thanks

    Mrs Spence

  6. #6
    Join Date
    Aug 2004
    Posts
    9,910
    Thanks
    3
    Thanked 969 Times in 957 Posts
    Blog Entries
    15

  7. #7
    Join Date
    Feb 2006
    Posts
    230
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Default

    DDadmin, yes I have a search result, but it seems to happen with, at least, everything from Google, and maybe others, too. I can see the results when I use the code provided by Google:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google AJAX Feed API - Simple Example</title>
        <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAQbQUbf-dyICxJd0dlqJU_xQLoWoI2H279niKOwg7OooTRHa47hT0V4c38X9vhAiK31UxiMKr7mcHRw"></script>
        <script type="text/javascript">
     
        google.load("feeds", "1");
     
        function initialize() {
          var feed = new google.feeds.Feed("http://news.google.com/news?hl=en&ned=us&q=modis+image&ie=UTF-8&output=rss");
          feed.load(function(result) {
            if (!result.error) {
              var container = document.getElementById("feed");
              for (var i = 0; i < result.feed.entries.length; i++) {
                var entry = result.feed.entries[i];
                var div = document.createElement("div");
                div.appendChild(document.createTextNode(entry.title));
                container.appendChild(div);
              }
            }
          });
        }
        google.setOnLoadCallback(initialize);
     
        </script>
      </head>
      <body>
        <div id="feed"></div>
      </body>
    </html>
    And if you run the DD script, adding the line from Google:
    HTML Code:
    <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAQbQUbf-dyICxJd0dlqJU_xQLoWoI2H279niKOwg7OooTRHa47hT0V4c38X9vhAiK31UxiMKr7mcHRw"></script>
    Only one appears.......

  8. #8
    Join Date
    Aug 2004
    Posts
    9,910
    Thanks
    3
    Thanked 969 Times in 957 Posts
    Blog Entries
    15

    Default

    I just tested the script using your RSS feed (http://news.google.com/news?hl=en&ne...-8&output=rss), and it works fine for me. For example:

    Code:
    <script type="text/javascript">
    
    var socialfeed=new gfeedpausescroller("example2", "example2class", 3000, "")
    socialfeed.addFeed("Google", "http://news.google.com/news?hl=en&ned=us&q=modis+image&ie=UTF-8&output=rss") //Specify "label" plus URL to RSS feed
    socialfeed.displayoptions("label datetime") //show the specified additional fields
    socialfeed.setentrycontainer("li") //Display each entry as a DIV
    socialfeed.filterfeed(15, "label") //Show 15 entries, sort by label
    socialfeed.entries_per_page(3)
    socialfeed.init() //Always call this last
    
    </script>
    Make sure you're calling the gAjax script correctly.

  9. #9
    Join Date
    Feb 2006
    Posts
    230
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Cool

    Thanks for the test.....I discovered something strange about the way the DD script works. If the feed before Google has only one item, then that Google feed will show only one item. If the feed before Google has 4 items, then the Google line will show four items, etc. If I put it in as the first line, it will display 6 items. I haven't been able to figure out what's going on, but there is definitely something controlling the number of elements retrieved from the feed and apparently by the number of elements in the previous line. The lines that I'm using for testing are:
    HTML Code:
    socialfeed.addFeed("NASA", "http://www.nasa.gov/rss/image_of_the_day.rss")
    socialfeed.addFeed("A", "http://modis.gsfc.nasa.gov/rss/rss.xml") 
    socialfeed.addFeed("B", "http://earthobservatory.nasa.gov/eo.rss") 
    socialfeed.addFeed("C", "http://www.nasa.gov/rss/NASAcast_video.rss")
    socialfeed.addFeed("D", "http://feeds.foxnews.com/foxnews/science")
    socialfeed.addFeed("E", "http://news.google.com/news?hl=en&ned=us&q=modis+image&ie=UTF-8&output=rss")
    socialfeed.addFeed("F", "http://news.google.com/news?hl=en&ned=us&q=modis+fire&ie=UTF-8&output=rss")
    socialfeed.addFeed("G", "http://news.google.com/news?hl=en&ned=us&q=modis+dust&ie=UTF-8&output=rss")
    socialfeed.addFeed("H", "http://rss.news.yahoo.com/rss/oped")
    socialfeed.addFeed("I", "http://rss.news.yahoo.com/rss/climatechange")
    socialfeed.addFeed("J", "http://rss.news.yahoo.com/rss/pollution") 
    socialfeed.addFeed("K", "http://rss.news.yahoo.com/rss/environment") 
    This isn't the order that I had them in originally, but try it out and you will see that the number of elements displayed for the different topics change with the order in the script.....
    Last edited by Strangeplant; 11-02-2007 at 03:03 PM. Reason: adding word

  10. #10
    Join Date
    Aug 2004
    Posts
    9,910
    Thanks
    3
    Thanked 969 Times in 957 Posts
    Blog Entries
    15

    Default

    Hmm I'm still not quite sure what I should be looking for in terms of an error. I tried the feeds code you posted above, and even altered some of their positions- the script manages to display them correctly. That is to say, 3 per page.

    Note that how many entries show up are controlled by the lines:

    Code:
    socialfeed.filterfeed(15, "label") //Show 15 entries, sort by label
    socialfeed.entries_per_page(3)
    In the above case, it means 3 entries per page, 5 pages total. However, consider if instead of 15, you had entered 8. Since 8 doesn't divide into 3 exactly, what you end up with is 3 entries for the first 2 pages, then 2 entries on the final. Not sure if this is the issue you're talking about.

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
  •