0
votes

Can I create my own nested portlet? i need to have a nested portlet, in which to add three custom portlets. Those three portlets should be added from code.

1
This would be dangerous because your portlet would need to contain code to implement a portlet container as well. Even if you borrow this functionality from Liferay, it would still be ugly. That said, Liferay can probably do things that you do not yet know of to solve this problem you have, so it might be worth re-asking the question with more details of what you need to do.trognanders

1 Answers

2
votes

Can you do it? Yes. Should you do it? Well...

Consider using standard Layout templates - these are extremely quick to create.

For populating a page with content/portlets, I'm typically pointing to the sourcecode for sevencogs-hook (which was delivered up to Liferay 6.1.0 CE but is still valuable documentation for placing portlets on a page - among other things). Others might point you to dynamically adding portlets to a page.

If you have a limited amount of variations of portlets that you'd like to add to the page/nested portlet, consider adding all of them but selectively not displaying any content (e.g. use inter-portlet-communication) - this makes it more obvious to the random page administrator (who might be someone else than you) which content will be displayed where. Also, it gives you flexibility if you want to rearrange the output.

Picking up my first paragraph - just look at the source code for the core nested-portlet to figure out the mechanics to dynamically dispatch to embedded portlets if you can't think of solving the problem in any of the alternative ways that I've suggested. If you can't figure it out (or if the "how" was your original question") please edit your question and clarify what the actual question is - I have the feeling that you're not interested in a yes/no answer.