0
votes

I'm new to the Liferay Portal and I have been assigned to develop a Liferay application with the following structure:

  1. logo
  2. search bar
  3. result list

We plan is to sell the application to different customers so the resources like images (logo and so on) and css need to be customizable. According to this tutorial resources like images and style sheets are part of the portal apps which are deployed to Liferay. So in my case for 2 different customers I would need 2 different app versions. Instead I'd like to have one version of the portlet which would load all the resources from a database (maybe via a rest call to an appropriate configuration service). That would give us an opportunity of a better provisioning.

Furthermore I'd like to be able to share css resources between different portlets.

Any ideas how I can achieve this 2 goals?

3
You'll need to decide for Liferay 6 or Liferay 7 (in your tags) or give reason why both versions are referenced.Olaf Kock

3 Answers

3
votes

You seem to be talking about themes. You need to create a Liferay Theme. You can Extend an existing Liferay theme or create a brand new. Themes are like portlets meaning you deploy them the same way only they are specific for what you seem to be descibing. Take a look at https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/theme-builder.

Here you have lots of examples https://github.com/liferay/liferay-plugins/tree/master/themes and scripts for generating new themes.

Hope it helps

3
votes

As Sudakatux said, you're talking about themes. I'd just like to add a couple of things:

  • If you're talking about styling portlet content (i.e. what should it look like when you display content in a portlet), you want to search for Application Display Templates (see links below).
  • If you're talking about styling portlet itself, i.e. what it looks like when you place portlets on your LR, you can do that within a theme.
  • Themes in Liferay 6.2 and 7.x are incompatible. You tagged the question LR-6 and LR7; I'd recommend choosing one (LR7 is vastly easier and faster to develop themes for, in my experience)
  • If you are creating your own portlet, and you want to style the content of your own portlet, you'll have to do that within JSPs. Edit: You can also use Freemarker with your portlets; however, I personally still prefer JSPs due to the sheer power of what you can do within it.

Useful links:

0
votes

This is how your theme directory structure should be laid out in Liferay 7 DXP. Make sure though you create a Liferay Workspace and create a Liferay module ( theme ) in that workspace. If you do not, you will have lots of errors and cause yourself much confusion.

You can put all your css changes in the _custom.scss file and they will overwrite the default css styles.

Blade CLI will generate the core freemarker templates. I recommend a header/footer template as well.

Theme directory structure

Lastly, this is how you reference the logo in your freemarker template

 <a class="${logo_css_class}" href="${site_default_url}" title="<@liferay.language_format arguments="${site_name}" key="go-to-x" />">
            <img alt="${logo_description}" class="logo1" src="${site_logo}" />
        </a>