Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Wessel Oosthuizen
IFrame URL Parameters
September 18, 2012 1:15 PM
Answer

Wessel Oosthuizen

Rank: Junior Member

Posts: 25

Join Date: August 9, 2012

Recent Posts

Hello,

I would like to pass any parameter in the URL of an IFrame portlet. For example, if the URL is http:www.google.com, I would like to pass the logged in username, password, and maybe a permission set for the logged in user in the URL.

So the URL would end up looking something like "Http://www.google.com?username=<uname>&password=<pwd>&permissions=<permissions>"

Is it possible to do this without any custom coding, like are there any placeholders for those values built into Liferay? For example, if you specify @username@ the portlet would automatically know to replace that value with the loggedin users username at runtime.

So essentially the above URL in the portlet configuration would look something like:
"Http://www.google.com?username=@username@&password=@password@&permissions=@permissions@"

Thanks
Wessel Oosthuizen
Michele Zanarotti
RE: IFrame URL Parameters
October 18, 2012 12:46 AM
Answer

Michele Zanarotti

Rank: Junior Member

Posts: 84

Join Date: February 20, 2012

Recent Posts

As they say there http://www.liferay.com/community/forums/-/message_boards/message/4961541
the only solution is to customize the iframe portlet.

When im finished with my own customization , i can add here a more detailed description.
Michele Zanarotti
RE: IFrame URL Parameters
October 18, 2012 1:25 AM
Answer

Michele Zanarotti

Rank: Junior Member

Posts: 84

Join Date: February 20, 2012

Recent Posts

Here's the details :

I wanted to pass the site_id to the iframe. So i used this at the end java code of view.jsp (right before the jstl/aui script parts).

iframeSrc = iframeSrc.replaceAll("\\$site_id", themeDisplay.getLayout().getGroupId()+"");

This will do the trick. In portlet config you can set now your url like that :
sourceUrl :
http://someUrl/$site_id
Jitendra Rajput
RE: IFrame URL Parameters
October 25, 2012 3:52 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 709

Join Date: January 7, 2011

Recent Posts

You can do your changes by using hook. Look into html/portlet/iframe/view.jsp