Google feed API: Display multiple feeds in separate divs

908 views
Skip to first unread message

Jennifer Han

unread,
Aug 8, 2012, 3:46:53 PM8/8/12
to google-ajax...@googlegroups.com
I'm trying to load 3 separate feeds and have them display in separate divs on the same page. Any way to do this?

I'm currently using this for a single feed:

  <script src="http://www.google.com/jsapi?key=AIzaSyA5m1Nc8ws2BbmPRwKu5gFradvD_hgq6G0" type="text/javascript"></script>
  <script type="text/javascript">
  /* How to use the Feed Control to grab, parse and display feeds. */
  
  google.load("feeds", "1", {'nocss' : 1});
  
  function OnLoad() {
    // Create a feed control
    var feedControl = new google.feeds.FeedControl();
    feedControl.setNumEntries(25);
    
    // Add feeds.
    feedControl.setLinkTarget("_blank");
// Draw it.
    feedControl.draw(document.getElementById("articles"));
  }
  
  google.setOnLoadCallback(OnLoad);
  </script>

Jeremy Geerdes

unread,
Aug 8, 2012, 3:49:14 PM8/8/12
to google-ajax...@googlegroups.com
 function OnLoad() {
    // Create a feed control
    var feedControl = new google.feeds.FeedControl();
    feedControl.setNumEntries(25);
    
    // Add feeds.
    feedControl.setLinkTarget("_blank");
// Draw it.
    feedControl.draw(document.getElementById("articles"));

    var feedControl2 = new google.feeds.FeedControl();
    feedControl2.setNumEntries(25);
    feedControl2.addFeed("...");
    feedControl2.draw(document.getElementById('otherArticles'));

    ...
  }

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to
google-ajax-searc...@googlegroups.com
To view this message on the web, visit
https://groups.google.com/d/msg/google-ajax-search-api/-/5VHFgjsZ4HQJ
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

Jennifer Han

unread,
Aug 9, 2012, 5:25:40 PM8/9/12
to google-ajax...@googlegroups.com
Worked like a charm. Thanks!

Kevin

unread,
May 13, 2014, 7:25:40 AM5/13/14
to google-ajax...@googlegroups.com
Is there any callback mechanism to make sure all feeds are loaded ??

Thanks
Reply all
Reply to author
Forward
0 new messages