As most readers will probably know, one of the most powerful characteristics of Liferay's portlets is the fact that when they are added to different communities or organizations (whenever I use the word community from now on it also applies to organizations) they act as completely independent portlets, each with it's own data. For example, if you have two communities, one called "Soccer lovers" and another one called "Soccer haters", which have the message boards portlet added to their pages, each of them will effectively have their own independent forum. As you can guess from this example that's very important because otherwise the results would be unpredictable. The following diagram shows how the data from each forum is stored separately in the database:
This is one of the reasons why many people use Liferay's tools instead of specific purpose tools, because that way a single installation can hold tens, hundreeths or even thousands of forums, blogs, wikis, etc. One per community of the system. But apparently many people thought that wasn't enough and they started asking for the ability to have several independent instances of those tools per community.
That's one of the things I love about Open Source, there is always people pushing you to go one step further. Not only that, but sometimes one community member not only asks for the functionality but steps ahead and offers to help. In this case, that community member was [url=http://www.liferay.com/web/jesperw/profile]Jesper[/url] and the people from Kanal5. Jesper discussed with us the best approach to implement this possibility and some time later provided a working implementation for it. From there on Brian and I worked on some improvements but most of the hard work has already done. Thanks a lot Jesper!
Back to the functionality, it works by allowing each community to have several scopes of data. 'scope' is just the term we've decided to use to mean a set of data (for example forum categories and threads) that is isolated from other data of the same portlet. Any community has a default scope (what Liferay already had in all versions prior to 5.1) and it's also possible to create [b]an additional scope per page[/b] (either public or private).
Let's use the message boards portlet again as an example to explain how to create an additional scope. When the portlet is added to any page of the "Soccer lovers" community it will use the default scope. If they add the portlet to a second page, it will show the same data as in the first page (see note 1) To make this portlet use a different data scope you have to follow this simple steps:
1) Go to the configuration of the portlet
2) Click the tab called scoping
3) Using the select box choose "Current page (forum)" and save
4) Go back and use the portlet to add any data that will now be specific to this page.
Repeat for as many pages as desired, with any portlet that supports scoping. All of Liferay's core portlets where it makes sense to use this feature have been modified to support it. Furthermore, it's been implemented in a way that it's quite easy to add support for it for custom portlets too (I can write another blog entry about how to do it if there is enough interest).
That's it, enjoy the feature and I hope you like it.
Note 1: We've decided to keep the previous behavior so that any portlet added uses the default scope of the community. This way if you don't need more than one scope per community (which we think is going to be the most common case) things just work as they've always worked. If you do need several scopes you just have to follow a few extra steps as outlined above.

