« Retour - Customization

Default User Portlets

(Redirigé depuis Associating a portlet To A page)

Introduction #

During liferay customization one common requirement is to configure the default portlets that are added to the pages of users or to the default guest community. For example instead of showing the portlets "Hello World" or "Currency Converter" we may want to show some custom portlets called "AboutUs" and "OurMileStones".

Default user public and private pages #

Like most of the configuration options in Liferay they are specified in the file Portal.properties. The default configuration looks like this:

    #
    # Set the portlet ids for the columns specified in the layout template.
    #


    default.user.public.layout.column-1=82,23

Where 82,83 are the portlet id (portlet-name) of the portlets "Alerts" and "Language" respectively. The id of the portlet is specified in the portlet.xml file. If the portlet is distributed as part of a plugin the name of the plugin is suffixed as shown below with the following format:

porltetName_WAR_warFileNameAs an example let's assume that we have developed two new portlets called "AboutUs" and " OurMileStones". We are distributing them within a plugin called MyCompany.war. To add these portlets by default in the private make this portlet default for user public lay out, edit portal-ext.properties as follows.

default.user.public.layout.column-1=AboutUs_WAR_MyCompany,OurMileStones_WAR_MyCompany

The example in the previous seciton was showing how to change the portlets available in the area of the page referred to as "column-1". Usually all areas are named with the prefix "column-" followed by a number from 1 to 10 (the actual names may vary depending on the Layout Templates being used). For example:

    default.user.public.layout.column-2=11,29,8,19
    default.user.public.layout.column-3=
    default.user.public.layout.column-4=

It's also possible to follow a very similar set of properties to specify the default portlets of the private pages of a user:

    default.user.private.layout.column-1=
    default.user.private.layout.column-2=
    default.user.private.layout.column-3=
    default.user.private.layout.column-4=

How to provide different configurations based on the user profile #

If you need different configuration based on the user profile check How To Use User Group Page Templates

Default portlets for the Guest community #

It's also possible to specify through configuration the default portlets shown in the public pages Guest community. Just follow the same instructions as those of the previous section with the following properties

    default.guest.public.layout.column-1=58
    default.guest.public.layout.column-2=47
    default.guest.public.layout.column-3=
    default.guest.public.layout.column-4=
Moyenne (1 Voter)
L'estimation moyenne est de 5.0 étoiles sur 5.
Commentaires
Réponses Auteur Données
Hi Manuj, I think this article is missleading.... Jorge Ferrer 2 septembre 2009 10:04
Thank you Jorge, I want to change the title... Manoj Kumar Pradhan 3 septembre 2009 01:27
I've just done it for you. I've also edited the... Jorge Ferrer 3 septembre 2009 08:23
Thank you Jorge. Now it looks great and more... Manoj Kumar Pradhan 6 septembre 2009 22:04
Thank you for this entry! This fixed all my... Ryan Connolly 17 novembre 2010 08:28
Quick question: Is there a way to specify the... Ryan Connolly 17 novembre 2010 08:31
So there are Page Templates and Site Templates.... Dana Oredson 21 décembre 2010 14:18
Can anybody tell me where do we need to keep... Biresh Choudhury 9 avril 2011 05:11

Hi Manuj,

I think this article is missleading. What you describe is not how to associate a portlet to a page, but to change the portlets that appear by default when a user logs in.

Also you added way too many tags which make them not very useful.

Please fix these issues so that the article can be kept in the wiki.
Publié le 02/09/09 10:04.
Thank you Jorge, I want to change the title "Associating a portlet To A page" To "How to change the portlets that appear by default when a user logs in".
This is more relevent.
But I am new to this wiki, could you please guide me how to change the title ?
( Shall I create a new wiki page with this new name ? )

Regarding the content I will edit ASAP.
Publié le 03/09/09 01:27 en réponse à Jorge Ferrer.
I've just done it for you. I've also edited the article to make it comply with the style guidelines and added some additional information.

Thanks Manoj
Publié le 03/09/09 08:23 en réponse à Manoj Kumar Pradhan.
Thank you Jorge.
Now it looks great and more informative
Publié le 06/09/09 22:04 en réponse à Jorge Ferrer.
Thank you for this entry! This fixed all my issues related to specifying the default portlets in user's private pages. After getting discouraged because the information in the following thread was not working for me on LR 6.0.5, finding this post was just the thing I needed!

http://www.liferay.com/community/forums/-/message_boards/message/246440

Th­anks, again.
Publié le 17/11/10 08:28.
Quick question: Is there a way to specify the default private page TYPE? I would like instead of Portlet page type a Panel page type.

Thanks in advance,
-Ryan
Publié le 17/11/10 08:31.
So there are Page Templates and Site Templates. Is there no way to make the user "home pages" use one of these?

I had thought to create a site template and associate that template with a User Group, then give my power users that user group (instead of Power User?). I have a feeling that won't be quite right. It won't really be the user's pages to modify at that point, but a "common area" where users of that user group can do stuff. Is that right?

I'm trying to avoid doing things with the portal-ext.properties, because that takes a deployment and restart of the server (and coordination with someone on the admin team - ugh.).

Thoughts?
Publié le 21/12/10 14:18.
Can anybody tell me where do we need to keep the war file. Do I need to keep the war file inside DEPLOY folder of liferay and once it's deployed same name needs to be given for the property "default.user.public.layout.column-1".
Publié le 09/04/11 05:11.