Difference between revisions of "Feeds integration"

From MPDLMediaWiki
Jump to navigation Jump to search
(New page: =Feeds integration = ==Possible solutions== *[http://code.google.com/apis/ajaxfeeds/| Google AJAX Feed API] ==Google AJAX API== ===Cons/Pros=== ====Pros:==== * Very simple to implemen...)
 
Line 46: Line 46:
   <h:inputHidden id="rssFeedUrl" value="#{BlogBean.rssFeedUrl}"></h:inputHidden>
   <h:inputHidden id="rssFeedUrl" value="#{BlogBean.rssFeedUrl}"></h:inputHidden>
</code>
</code>
 
* The Google AJAX Feed API might be used with a Google AJAX key [http://code.google.com/apis/ajaxfeeds/signup.html]. This key is defined for one server (that means one key is needed for dev, qa, demo, live, ..., servers). The usefulness of that key is described here [http://code.google.com/apis/ajaxfeeds/key.html]. If you want to use it, add it as parameter in the url source of the first script
<code>
  <script src="http://www.google.com/jsapi?key=your-key">&amp;#160;</script>
</code>
* You can easily add additional feeds to your feedControl:
<code>
  feedControl.addFeed("http://url/of/second/feed/", "Second Feed name");
  feedControl.addFeed("http://url/of/third/feed/", "ThirdFeed name");
  ...
</code>




==More==
==More==


 
*[http://code.google.com/apis/ajaxfeeds/documentation Documentation of the API]
*[http://code.google.com/apis/ajaxfeeds/documentation/#FEEDCONTROL Documentation for the feedControl]


[[Category:How_To|Blog Feed HomePage Integration]]
[[Category:How_To|Blog Feed HomePage Integration]]

Revision as of 15:05, 2 February 2009

Feeds integration[edit]

Possible solutions[edit]


Google AJAX API[edit]

Cons/Pros[edit]

Pros:[edit]

  • Very simple to implement and to reuse.

Cons:[edit]

  • Google Terms of use : [1]

How to[edit]

To use the Google AJAX API please copy the following code on the jsp page:

<script src="http://www.google.com/jsapi">&#160;</script> 
<script>
  google.load("feeds", "1");
  function facesBlogInitialize() 
  {  	
      var feedControl = new google.feeds.FeedControl();
      feedControl.addFeed("http://url/of/the/feed/", "Feed name");
      feedControl.setNumEntries(6);
      feedControl.draw(document.getElementById("feedControl"));
  }
  google.setOnLoadCallback(facesBlogInitialize);
</script>

Remarks:[edit]

  • The first script element should not be minimized. To avoid the auto-minimization from JSF please write like it is on the previous code.
  • The url of the feed should be access from a backing bean with either

<h:outputText value="#{MyBackingBean.feedUrl}"/>

or replace the url with

document.getElementById("rssFeedUrl").value

and add in your jsp

 <h:inputHidden id="rssFeedUrl" value="#{BlogBean.rssFeedUrl}"></h:inputHidden>

  • The Google AJAX Feed API might be used with a Google AJAX key [2]. This key is defined for one server (that means one key is needed for dev, qa, demo, live, ..., servers). The usefulness of that key is described here [3]. If you want to use it, add it as parameter in the url source of the first script

 <script src="http://www.google.com/jsapi?key=your-key">&#160;</script> 

  • You can easily add additional feeds to your feedControl:

 feedControl.addFeed("http://url/of/second/feed/", "Second Feed name");
 feedControl.addFeed("http://url/of/third/feed/", "ThirdFeed name");
 ...


More[edit]