Knowing About the layout


We can Check the page whether it is private or public page using layout object.

layout.isPrivateLayout()
layout.isPublicLayout()

layout is an implict object in liferay

By using this "layout" object we can get title , description, theme applied to that page, group, Also we can get the child page and parent page details.

Forming the dynamic URL

PortalUtil.getPathFriendlyURLPublic() : It retrieves "/web"
PortalUtil.getPathFriendlyURLPrivateGroup() : It retrieves "/group"

themeDisplay.getScopeGroup().getFriendlyURL(): It retrieves site name(ex: guest)

So finally we can write as,

If we want Public Page URL: PortalUtil.getPathFriendlyURLPublic()+ themeDisplay.getScopeGroup().getFriendlyURL() +StringPool.SLASH + "home";

It will be as "/web/guest/home.

Also If we want Private Page URL: PortalUtil.getPathFriendlyURLPrivateGroup()+ themeDisplay.getScopeGroup().getFriendlyURL() + StringPool.SLASH + "home";

It will be as "/group/guest/home.


Comments

  1. Thank you.Its a valuable information about layout.

    ReplyDelete
  2. this is a very great post.Thank you for giving valuable information.If you have any queries in essay writing go through admission essay writing service

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate