Introduction #

Most of your contents in Liferay (Web Content, Blogs, images, documents, bookmarks, messages... etc) belong to a group in your portal. (A group can be an organization, a community or even the personal community of a user).

For this reason, if you show the Blog portlet (or any other non-instantiable portlet) in different pages of your organization it will show always the same content: the blog entries of that organization.

However, it is possible to have different scopes in a community/organization (a different scope for each page), allowing you to have two Blogs Portlets with different content in the same organization/community.

Creating Scopes #

Most of the portlets support scopes by default. When you are in a page (called Welcome, for example) and you have the wiki portlet and the blogs portlet there, you can change the scope of each portlet going to the Configuration of the portlet --> Scopes.

You can make the wiki portlet to use this new scope (Welcome) and the blogs portlet to keep using the default one, or change both, that is up to you.

How Can I Make My Custom Portlet Support Scopes? #

In the liferay-portlet.xml of your portlet, you can set the element scopeable to true:

If the scopeable is set to true, an administrator will be able to configure the
scope of the data of the portlet to either the current community (default),
the current layout, or the scope of any other layout of the community that
already exists. Portlets that want to support this must be programmed to obtain
the proper scope group id according to the configuration and scope their data
accordingly. The default is false.
1 Attachment
50425 Views
Average (4 Votes)
The average rating is 3.25 stars out of 5.
Comments
Threaded Replies Author Date
Great start. Would be nice to see a code... Phoenix Zerin September 9, 2011 11:36 AM

Great start. Would be nice to see a code example of how to use scope in a portlet.
Posted on 9/9/11 11:36 AM.