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:
Portlet: A standard page that is a container for one or more portlets
Embedded: Embeds the contents of another URL into the page (i.e. the page contents will be the page contents of the specified URL).
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).
Article: Unknown purpose. Does not seem to be referenced in the code. (Layout 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.
==================================================================
Layout Set
Each layout is a member of layout set (com.liferay.portal.model.LayoutSet). A layout set represents a group of layout pages, and thus a layout set can be thought of as a "web site", or more specifically, a "portal instance." Since each user has a private group associated with them, this allows each individual user to maintain their own custom portal.
The theme and color scheme used by a layout can either be set individually for the layout, or it is inherited from its layout set.
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:
Portlet: A standard page that is a container for one or more portlets
Embedded: Embeds the contents of another URL into the page (i.e. the page contents will be the page contents of the specified URL).
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).
Article: Unknown purpose. Does not seem to be referenced in the code. (Layout 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.
==================================================================
Layout Set
Each layout is a member of layout set (com.liferay.portal.model.LayoutSet). A layout set represents a group of layout pages, and thus a layout set can be thought of as a "web site", or more specifically, a "portal instance." Since each user has a private group associated with them, this allows each individual user to maintain their own custom portal.
The theme and color scheme used by a layout can either be set individually for the layout, or it is inherited from its layout set.