Foren

Making portlets "page aware"

Peter Casier, geändert vor 14 Jahren.

Making portlets "page aware"

New Member Beiträge: 2 Beitrittsdatum: 27.05.09 Neueste Beiträge
I am exploring possibilities with LifeRay, comparing to other CMS, so not a LifeRay specialist (so bare with me).

Is there a way to make a LifeRay portlet, "Page aware"...

Here is what I want to do:

1/ I have different pages, which are all based on a country name. The names are standard. e.g. Pakistan is "PAK"

2/ On each page, I want to create a portlet which e.g. shows a Google news feed, and another which shows me a query from an internal database.
The first needs a full name e.g. "Pakistan", the second needs an internal abbreviation, e.g. "PST" as qualifier for the query.

3/ I want to display the 2 portlets from (1) in different pages, but change the query dependent on the page.
e.g. on the "PAK" page, I want to have
- the portlet for Google news change the RSS URL to "http://news.google.com/news?hl=en&ned=us&q=pakistan&ie=ISO-8859-1&output=rss"
- the portlet for the internal query needs to change the query to "Get /all/country="PST"

This probably means I need to have a translation database, with the different 'variations' of the name.

e.g. <page country name> <full name> <queryname)
like PAK, Pakistan, PST

Any hint if this is possible, and where we should start?

P.
thumbnail
Olaf Kock, geändert vor 14 Jahren.

RE: Making portlets "page aware"

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
Look for "public render parameter" or portlet eventing to distribute information between portlets. Here is a blog entry with an example application (WeatherMap) where multiple portlets share information.

Now - If only it could access the request parameters... ;)
atul patel, geändert vor 14 Jahren.

Re: [Liferay Forums][3. Development] Making portlets "page aware"

Regular Member Beiträge: 192 Beitrittsdatum: 18.11.06 Neueste Beiträge
I would do something like this.

Establish a naming convention for the pages' friendly url ie.
/somecommunity/pakistan

Have an internal table that uses the friendlyurl as the key and has
the rss code, internal query, etc.

Modify the RSS portlet such that it will support dynamic params in
some way. Prior to requesting the rss feed, the portlet would
recognize the token in the rss url and replace it with a looked up
value.

Hope this gives enough of a direction.

Instead of having an internal table, I've always thought that page
properties would be handy... Basically we could add a text area box
on the manage pages screen where a person could add properties to the
page. Then add a method such as:

public Properties getPageProperties to the Layout class.

Any thoughts on this?

On Wed, May 27, 2009 at 2:41 AM, Peter Casier from liferay.com
<no-reply@liferay.com> wrote:
> I am exploring possibilities with LifeRay, comparing to other CMS, so not a
> LifeRay specialist (so bare with me).
>
> Is there a way to make a LifeRay portlet, "Page aware"...
>
> Here is what I want to do:
>
> 1/ I have different pages, which are all based on a country name. The names
> are standard. e.g. Pakistan is "PAK"
>
> 2/ On each page, I want to create a portlet which e.g. shows a Google news
> feed, and another which shows me a query from an internal database.
> The first needs a full name e.g. "Pakistan", the second needs an internal
> abbreviation, e.g. "PST" as qualifier for the query.
>
> 3/ I want to display the 2 portlets from (1) in different pages, but change
> the query dependent on the page.
> e.g. on the "PAK" page, I want to have
> - the portlet for Google news change the RSS URL to
> "http://news.google.com/news?hl=en&ned=us&q=pakistan&ie=ISO-8859-1&output=rss"
> - the portlet for the internal query needs to change the query to "Get
> /all/country="PST"
>
> This probably means I need to have a translation database, with the
> different 'variations' of the name.
>
> e.g. <page country name> <full name> <queryname)
> like PAK, Pakistan, PST
>
> Any hint if this is possible, and where we should start?
>
> P.
> --
> Liferay Message Boards
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/3189708
> mb.239390.3189708@events.liferay.com
> http://www.liferay.com
Rice Owl, geändert vor 14 Jahren.

RE: Re: [Liferay Forums][3. Development] Making portlets "page aware&#

Regular Member Beiträge: 177 Beitrittsdatum: 24.04.09 Neueste Beiträge
I ran into similar problems when I was doing some RSS portlets in an Oracle Portal environment. Oracle Portal has the concept of "Page Parameters" - not sure if LifeRay has this as well. The problem is that only Oracle PDK portlets supported accessing these page parameters and not JSR 168 portlets.

The approach I took on the Oracle portlet was I embeded some javascript on the page which contained a key to identify the "page" or the portlet, then the RSS portlet, read this key and used that to load the RSS feeds. it was using AJAX anyway so it could update asynchronously, so this solution worked fine. Like the previous poster said, I had a database table that served as a key and held the various RSS feeds for that particular portlet. The portlet referenced the embedded javascript, called a servlet for the ajax, passing in the ID, the servlet looked up the feeds using the passed in paramater as the key, and got a list of feeds.
Peter Casier, geändert vor 14 Jahren.

RE: Making portlets "page aware"

New Member Beiträge: 2 Beitrittsdatum: 27.05.09 Neueste Beiträge
Thanks you all for the good tips!!

Peter