| Author |
Can I get the page layout model in the portlet? Side-by-side or single page (under eac
|
|
|
| Hi!
Is there any way to get the layout mode of the page in WPS 5.1?
I don't mean in the theme but in the portlet. I would like to change the layout if the portlet is side-by-side with another portlet or if the portlet is under another portlet.
As you know there are different strategies when placing portlets in a page. One of the is "single page" and another is two columns. Is there a way to - from a portlet (IBM) - get the layout mode of the page that is invoking the portlet?
Any clues? It feels like kind of off-pist!
Thanks!
Karin
| |
| Dennis te Lintelo 2006-01-29, 9:46 pm |
| Karin,
There is a way to get the layout mode of a portal page. I once did some testing with the code below which gives you the ContentNode of the portal:
InitialContext ctx = new InitialContext();
ContentModelHome cmHome =
(ContentModelHome)ctx.lookup("portal:service/model/ContentModel");
ContentModelProvider cmProvider = cmHome.getContentModelProvicer();
ContentModel cModel = cmProvider. getContentModel((ServletRequest)request,
(SerlvetResponse)response);
ContentNode root = (ContentNode)cModel.getRoot();
From the root you can iterate through the children and check if the node is:
- a ContentNode
- a Container
- a Control
You should be able to get the layout of the page from either the Container or the Control (not certain which one it was...)
Have fun!
Dennis
| |
|
| Thanks Dennis!
I also found this content model and I'm trying to use the Layout Model for the page. Hopefully it will work. Or I'll add some configuration to my portlet.
If I use the SPI it will require 5.1.0.1 and I'm not sure if I should go down that road just yet.
Here is a link to the Info Center for the SPI Model:
http://publib.boulder.ibm.com/infoc...n_modelxmp.html
Regards
Karin
| |
| Dennis te Lintelo 2006-01-29, 9:47 pm |
| Karin,
Be also aware of the fact that I found it to be rather slow...This could be because I started from the portal root, but keep it in mind.
If you do have a piece of code which only takes care of the current page, I am very interested...:-)...
Thanks,
Dennis
|
|
|
|