As the concept of the web as an application itself rather than a number of islands of applications takes hold in the mindshare of the Internet's users, widgets have become very popular nowadays. This concept is sometimes referred to as "Web 2.0" and is very much enabled by widgets. So what is a widget? A widget is a small piece of code that can be included on any web site that provides a piece of functionality, 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 using its portlets as widgets. You can embed a particular instance of a portlet running on your site into another site, such as Facebook, to which you have access to add content. This opens up a whole new avenue of exposure to your web site that you would not otherwise have had.
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. Under this are three tabs.
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 52: Liferay's forums in FacebookFriends
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.