The web was once thought of as a number of islands of applications in a vast universe of "cyberspace." Everybody tried to make their island the biggest. Some succeeded and some failed. More recently, the concept of the web as an application itself has taken hold, and so widgets have become very popular nowadays. This concept is part of the "Web 2.0" concept and is very much enabled by widgets. So what is a widget? A widget is a small piece of code which provides a piece of functionality, can be included on any web site, but does not necessarily have to be hosted by that web site. If you have ever embedded a YouTube video on your own web site so that users could watch a video without actually having to visit http://youtube.com, then you have already used a widget.
Liferay supports serving its portlets as widgets. You can embed a particular instance of a portlet running on your site into another site, such as Facebook. This opens up a whole new avenue of exposure to your web site that you would not otherwise have had. In fact, this is how all those Facebook games work.
To share one of your portlets as a widget, go to the Configuration option in the menu in the portlet's title bar. Then click the Sharing tab. There are five subtabs under sharing: Any Web Site, Facebook, Google Gadget, Netvibes, and Friends.
Any Web Site
Copy and paste the snippet of code into the web site to which you want to add the portlet as a widget. That's all you need to do. When a user loads the page on the other web site, the code will pull the relevant portlet from your site and display it.
You can add any Liferay portlet as an application on Facebook. To do this, you must first get a developer key. A link for doing this is provided to you in the Facebook tab. You will have to create the application on Facebook and get the key and canvas page URL from Facebook. Once you have done this, you can copy and paste their values into the Facebook tab. Your portlet will now be available on Facebook as a Facebook application.
Illustration 72: Liferay's forums in Facebook
iGoogle is service provided by Google that lets users create a customizable page and add Gadgets to that page. Liferay can serve up portlets to be used as Google Gadgets on an iGoogle page.
Check the box labeled Allow users to add [portlet-name] to iGoogle. Copy and paste the URL provided into Google's Add a feed or gadget feature on the iGoogle configuration page, and Liferay will serve that portlet directly onto your iGoogle page. The URL provided is unique to the specific instance of the portlet, so you could serve multiple instances of the same portlet as different Google Gadgets.
This feature could be useful to allow users to view what's happening on your portal at a glance, with asset publishers or custom RSS feeds. You could also use Liferay's API to build your own portlet and provide the URL for users to place on their iGoogle pages.
Netvibes offers a similar service to iGoogle – users can log in, create their own personal portal, called a dashboard, and add customizable widgets to the dashboard that they create. To set up Netvibes support for a particular portlet, check the Allow users to add [portlet-name] to Netvibes pages box. You can then use the provided URL to create a custom Netvibes widget based on the instance of the portlet that you're using.
The final sub-tab in the Sharing tab is called Friends. This tab has a single check box that allows you to give your friends permission to add the application as a widget to another web site. This could be particularly useful for your blog or your calendar if you wish to share them.