0

I'm new to Liferay and I'm trying to figure out if it's possible to dynamically add or subtract child pages on the fly. From what I've done so far I've only been able to use the Admin Control Panel to add a static amount of child pages to a main page.

My use case is I have a main page that houses all of my graphing charts and then I have a bunch of child pages for each type of graph. The amount of graphs are dynamic depending on the company though so some may have 10 child pages and others may have only three. Is this possible? The only thing I've been able to find is this article on custom navigation, https://liferayinfo.wordpress.com/2012/09/24/liferay-custom-navigation/.

Kyle Bridenstine
  • 6,055
  • 11
  • 62
  • 100

1 Answers1

0

It depends on what you consider "dynamic": If it's literally "on the fly": Yes, there are options to dynamically handle pages - this approach is quite complex. Way too complex for a simple answer on stackoverflow.

But not everything is lost: You might get away with building your own navigation portlet that determines how many (and which) of the child pages that you've statically created get displayed, based on criteria that you know.

When each of your companies (careful: Misleading term - Liferay uses "company" as the technical name for "portal instance") uses a different site, you can also use site templates, or page templates - including this custom navigation portlet.

Also you can always create pages and page hierarchies with Liferay's API. Thorsten Laux's comment already mentions LayoutLocalService. For maintainability: it'll be easier if you use it statically when you create the pages, instead of dynamically when you have the data (there we are again: dynamic use is too complex for this answer).

If it's good enough to hide certain pages: Go with a custom navigation portlet instead of Liferay's own. Depending on the complexity that you're willing to end up with: You can either create your own portlet or utilize a WebContent structure and template to dynamically decide which pages to link and which not to link (which effectively will hide them).

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90