RE: WebContent or Portlet? Not sure which one to use.. (design question)

S N, modified 6 Years ago. New Member Posts: 3 Join Date: 8/24/19 Recent Posts
We have a page which needs to have multiple panels/sections. Using Liferay 6.2.
1) First panel has fully dynamic content involving business data that can only be built with a portlet. This portlet would have preference(s).
2) The second panel has a bunch of (non-friendly) liferay links. No configuration needed here. Since these are non-friendly links, I assume we'll need to use a portlet here as well.
3) The third panel has a list of friendly links laid out in a specific way. The links' labels, URLs and targets must be configurable individually.
4) The Fourth panel has a single block of rich text. The entire text should be configurable.

After going through the Liferay documentation, I'm confused how to design the overall page. Options I've considered:
1) Design the overall page in webcontent (structure+templates) and inject the first panel's portlet as part of the template using <runtime-portlet>. While this would allow configurability of 3rd and 4th panels, but not sure how to handle the portlet preferences and the non-friendly links.
2) Design the overall page in portlet and use portlet preferences for all configuration. While panels 1,2,4 can be handled this way, not sure how to configure the panel 3's list of links - portlet preferences seem to allow only simple strings, not collection/map types. If I use rich text editor in portlet preference for panel 3, I'll have to leave the layout of links to the liferay administrator/content author, which I cannot do.
3) Design the whole page in portlet and use webcontent for panel 3 and portlet preferences for configuring the rest - portlet would pull in the journal article to render panel 3. This seems to be the most viable option although it's super messy - the panels' configurations are coming from two different places, and the panel 3 webcontent's template is mostly useless (since portlet controls the overall rendering). It's probably a misuse of the concept of webcontent just for configuration purpose.
4) Design panels 1,2 in portlet and 3,4 in webcontent. Allows easy configuration but again is super messy and is misusing webcontent?
Can you please help?
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I am not sure I understand your limitations. If it is just one page, you could also create a layout template that allows you to place Portlets/Webcontents in the way you need them. I am also not sure, why you think it's messy.
Also, maybe you could also create the second panel using Webcontent. (You probably have discarded that option for some other reasons, but I still wanted to mention it).
Also, I wouldn't sweat about "misusing" Webcontent. I do it all the time.
This is actually an Asset Publisher with Webcontent in each column:
https://devcon.dccs.at/de/web/guest/example-menuplan
https://devcon.dccs.at/de/web/guest/example-application (This one is even in 6.2)
In hindsight: The application worked like a charm. The menuplan was, in it's first implementation, hell on earth. The rewritten version shown in that presentation actually worked quite well and is in use for about 4 years now.
S N, modified 6 Years ago. New Member Posts: 3 Join Date: 8/24/19 Recent Posts
Second panel has non-friendly/non-direct links (commandLink in JSF), so I don't want to let content authors be able to configure it.
Sorry but what is a "layout template"? Do you mean the webcontent velocity template?

Christoph Rabel:

I am not sure I understand your limitations. If it is just one page, you could also create a layout template that allows you to place Portlets/Webcontents in the way you need them. I am also not sure, why you think it's messy.
Also, maybe you could also create the second panel using Webcontent. (You probably have discarded that option for some other reasons, but I still wanted to mention it).
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
So one rule of thumb I always try to follow - if you can do something with OOTB Liferay, do it with OOTB Liferay.

For me, the biggest reason for this is built-in upgrade support. Web contents are handled during Liferay upgrades, so this becomes a no brainer as it saves me future work.

However, when choosing between a custom portlet and some hokey implementation where a web content is running JS and maybe manipulating dom or whatever, I'll often go w/ the custom portlet. That way I won't have to worry about an upgrade or a fixpack or something breaking all of my web contents w/o my even knowing it.

From what you describe above, I would do #1 as a portlet, but 2-4 would all be web contents. It's totally fine to have links to external assets in your web contents, they aren't limited to portal-only assets.
S N, modified 6 Years ago. New Member Posts: 3 Join Date: 8/24/19 Recent Posts
Thanks, but what would you use to design the overall page template? Keep it in portlet or use webcontent for that too? In case of the former, I'd need to pull in the webcontent pieces using journal-article tag in portlet. If the latter, I'd need to pull in the portlet piece using runtime-portlet (but not sure how to deal with its preferences).
Also, I cannot use webcontent for the second panel since as I mentioned, it has non-friendly/non-direct links  (i.e commandLink in JSF)

David H Nebinger:

From what you describe above, I would do #1 as a portlet, but 2-4 would all be web contents. It's totally fine to have links to external assets in your web contents, they aren't limited to portal-only assets.
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
You don't need a page template, just a layout template w/ the right number of columns and the right widths.

Then drop your portlets (custom portlet and web content display portlets) into the columns in the right order and you're done.