Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
pawan chauhan
Access to page-URL inside portlet
January 4, 2013 6:08 AM
Answer

pawan chauhan

Rank: Junior Member

Posts: 75

Join Date: October 8, 2012

Recent Posts

Hi all,

I want to know if it's possible to access the info of a page in a portlet added on that page.
I mean is there any way to get a variable inside a porlet that may tell on which page/friendly URL the portlet has been added to.

Kindly help.
Regards,
Pawan Chauhan.
Bart Simpson
RE: Access to page-URL inside portlet
January 4, 2013 6:16 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

I want to know if it's possible to access the info of a page in a portlet added on that page.

If the portlet is already on the page then you should be able to get this info from themeDisplay and get the layout (which is basically is a page in liferay), here is the method
1Layout com.liferay.portal.theme.ThemeDisplay.getLayout()


Hope it helps
pawan chauhan
RE: Access to page-URL inside portlet
January 4, 2013 6:24 AM
Answer

pawan chauhan

Rank: Junior Member

Posts: 75

Join Date: October 8, 2012

Recent Posts

Thanks for the quick reply Bart..
I would like to ask a little more,

Suppose i have added two pages - say "home" n "tools" (which have the same custom theme n layout applied)

and added the same portlet on both the pages .. will i get different values and will i be able to know from which page(portlet), I am getting the values.

As i ask i am already on to it ...

Regards,
Pawan Chauhan.
Rahul Sharma
RE: Access to page-URL inside portlet
January 4, 2013 6:47 AM
Answer

Rahul Sharma

Rank: Junior Member

Posts: 60

Join Date: January 10, 2012

Recent Posts

Yes you will be getting different values when you place that portlet on two different pages and you will be able to get which page(portlet) is giving values,just use themeDisplay object to get the values.
Bart Simpson
RE: Access to page-URL inside portlet
January 4, 2013 7:04 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

yes, indeed the values for layout will be different, Layout in liferay represents a page and not the look and feel thing that you have seen as container for displaying portlets.
Hope it helps