Table of Contents [-]

    A layout is an instance of a single page, composed of one or more portlets arranged inside of various columns (sometimes referred to as the "narrow" and "wide" columns). A layout is somewhat synonymous with a "page" (i.e. a single web page). They have a unique internal ID known as the "portlet layout Id". They are stored in the Layout table. The primary key of the Layout table (com.liferay.portal.service.persistence.LayoutPK) is composed of the "owner id" and the "layout id". The "owner id" is composed of a prefix indicating if it is "public" (PUB.) or "private" (PRI.), followed by the "group id" (i.e. the community that owns the layout). A "public" layout is one that is shared by more than one user, and thus changes to the layout by the end user should not be persisted. To facilitate this, the portal system will "clone" a temporary version of the public layout for the user to configure. This temporary version survives only for the duration of the session.

    • Note in version 4.3, most primary keys in tables have been changed to "long", and thus the string key "owner Id" is no longer passed around. The primary key of the Layout table is now simply a "plid" that is a "long". The "owner Id" part has been broken out into an explicit group Id field, and an explicit boolean field named "private" to indicate if the layout is public or private.

    The layout Id is a sequential number unique for the specified owner Id.

    Every group has both a public and a private layout set associated with it. Thus (theoretically), every group has both a public and a private web site).

    Only users who are in the "Power User" category are allowed to create/modify layouts for the portal.

    The default user layout name is "Home", defined in portal.properties under default.user.layout.name

    Sometimes in the code, you'll see reference to the request parameter p_l_id (which may be represented by the variable plid). The "plid" is an encoded string that contains "owner ID" and "layout id" components concatenated. Call Layout.getLayoutId(plid) or Layout.getOwnerId(plid) to extract the desired component. The owner ID can further be de-composed into the group ID by calling Layout.getGroupId(ownerId) (Layout.getOwnerId(plid) is no longer available (nor needed) in 4.3. Layout.getGroupId() longer requires the plid parameter).

    A layout is assigned one of four types:

    1. Portlet: A standard page that is a container for one or more portlets
    2. Embedded: Embeds the contents of another URL into the page (i.e. the page contents will be the page contents of the specified URL).
    3. URL: Selecting this page will redirect the user to the new URL. Unlike Embedded, the browser's address will become the new URL (vs. having the contents found at the URL embedded in the portal).
    4. Article: Unknown purpose. Does not seem to be referenced in the code. (Layout|Type Creation describes it as: This type of layout shows a single content created with Liferay Journal)

    Internal code: A layout has an associated "type settings" (type as in class, not as in typeface), which holds type specific configuration. For example, the "type settings" for a Portlet layout is actually a comma separated list of name/value pairs (properties) that contains, among other things, the individual portlets that are contained within the layout. The "type settings" for URL are the URL iteself.

    A layout of type "portlet" is configured when you click on the "Add content" menu option in Liferay. That menu option calls a JavaScript function named LayoutConfiguration.toggle(), defined in the file /portal/portal-web/docroot/html/js/portlet/layout_configuration.js. That method initiates an AJAX call to render a special portlet known as the "Layout configuration" portlet. The code that handles the actual contents of the layout configuration portlet is located in /portal/portal-web/docroot/html/portlet/layout_configuration/.jsp.

    0 Attachments
    40533 Views
    Average (3 Votes)
    The average rating is 5.0 stars out of 5.
    Comments
    Threaded Replies Author Date
    in the liferay 6.0.1 i see there is a type... Andrius Kurtinaitis May 7, 2010 7:17 AM
    I've been looking for a way to dynamically... Stian Sigvartsen March 18, 2011 5:50 AM

    in the liferay 6.0.1 i see there is a type called "Panel" - what is it? How is it different from "Portlet" pages?
    Posted on 5/7/10 7:17 AM.
    I've been looking for a way to dynamically (programatically) add portlets to a layout within the scope of a user session. So only the current user will see specific portlets and only until their Liferay session expires. I'd like portlets to be displayed on demand based on interacting with other portlets that are already part of the layout. The dynamic portlets would provide dialog boxes etc.

    It sounds like the public layout concept described above facilitates this which is great!

    Is this feature still available in Liferay v6+?
    Is there any documentation beyond the above statement available?
    Posted on 3/18/11 5:50 AM.