Difference between revisions of "Feeds integration"
Jump to navigation
Jump to search
m (→More) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Possible solutions== | ==Possible solutions== | ||
*[http://code.google.com/apis/ajaxfeeds | *[http://code.google.com/apis/ajaxfeeds Google AJAX Feed API] | ||
==Google AJAX API== | ==Google AJAX API== | ||
Line 45: | Line 44: | ||
* 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 | * 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> | <code> | ||
<script src="http://www.google.com/jsapi?key=your-key">&#160;</script> | <script src="<nowiki>http://www.google.com/jsapi?key=your-key</nowiki>">&#160;</script> | ||
</code> | </code> | ||
* You can easily add additional feeds to your feedControl: | * You can easily add additional feeds to your feedControl: | ||
<code> | <code> | ||
feedControl.addFeed("http://url/of/second/feed/", "Second Feed name"); | feedControl.addFeed("<nowiki>http://url/of/second/feed/</nowiki>", "Second Feed name"); | ||
feedControl.addFeed("http://url/of/third/feed/", "ThirdFeed name"); | feedControl.addFeed("<nowiki>http://url/of/third/feed/</nowiki>", "ThirdFeed name"); | ||
... | ... | ||
</code> | </code> | ||
* To set the target of the links, add: | |||
<code> | |||
feedControl.setLinkTarget(google.feeds.LINK_TARGET_BLANK | google.feeds.LINK_TARGET_SELF | google.feeds.LINK_TARGET_TOP | google.feeds.LINK_TARGET_PARENT); | |||
</code> | |||
==More== | ==More== | ||
Line 60: | Line 62: | ||
*[http://code.google.com/apis/ajaxfeeds/documentation/#FEEDCONTROL Documentation for the feedControl] | *[http://code.google.com/apis/ajaxfeeds/documentation/#FEEDCONTROL Documentation for the feedControl] | ||
[[Category:How_To| | [[Category:How_To|Feeds integration]] |
Latest revision as of 12:35, 30 November 2011
Possible solutions[edit]
Google AJAX API[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, just reuse the following code and adapt the red parts with your configuration:
<script src="http://www.google.com/jsapi"> </script>
<script>
google.load("feeds", "1");
function initialize()
{
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(initialize);
</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="#{MyBackingBean.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"> </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");
...
- To set the target of the links, add:
feedControl.setLinkTarget(google.feeds.LINK_TARGET_BLANK | google.feeds.LINK_TARGET_SELF | google.feeds.LINK_TARGET_TOP | google.feeds.LINK_TARGET_PARENT);