LIFERAY 7.2 GA1 Theme: My custom scss style impacts the default Liferay Menu ( in the left hand side and in the top ) - liferay

I have a problem when developing a new Liferay 7.2 theme based on gradle as a build tool, the problem is when I added a custom css in the file _custom.scss in order to customize some styles within my theme, the default liferay admin Control panel and Menu( in the left hand side and in the top ) are looking very bad and my theme looks not Responsive(I mean the style and there are buttons which are not displayed anymore example the toast-animation-btn is not visible ).
From my perspective, maybe my custom css ( because I have a large css file it is kind of Migration from 6.2 --> 7.2) is impacting the default liferay portal things --> this is just my opinion and maybe I could be wrong...
Otherwise, if my reasoning is true please How could prevent my styles to impact liferay default menu?

A whole lot of things have changed between 6.2 and 7.x html markup. I would strongly advise testing each small css feature independently and rewrite the one that is not compatible anymore. By feature I mean all css code related to a specific portlet or section of your template.
Also the theme template themselves have changed a lot and are not strictly compatible. In this case I'd suggest starting with a new theme templates and bring back one by one the customization, you made in it. Also look at the new content page feature: https://portal.liferay.dev/docs/7-2/user/-/knowledge_base/u/creating-content-pages You might be able to replace many theme customization with them in a more maintainable and web admin-friendly way.
That being said if you just want to isolate you sass code from impacting the admin menu, in the default template there is no quick way to identify the content section of the page (well, there is #wrapper and #content, but they are too generic and present in the admin page as well) I'd suggest that you add an id at the right level of your own template. After that just embed all your sass code inside that id.

Related

Liferay Portal customization

I'm new to the Liferay Portal and I have been assigned to develop a Liferay application with the following structure:
logo
search bar
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?
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
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:
Liferay 6.2 Lunar Theme tutorial - shows how to create and deploy LR 6.2 theme
Liferay 7 Theme sample - LR7 has a Blade project that shows a lot by example. You can change Maven to Gradle and vice versa. Very useful.
Application Display Template LR7
Application Display Template LR6
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.
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>

CSS to Liferay theme

I have a css web design and I want to converted in Liferay theme. Is this possible?
I am using Liferay 6.1 Ga2 with Tomcat 7 and Liferay SDK for java.
Any advice will be appreciated!
Thanks in advance
If you have css designs then you can use it in your theme. But make sure that if you are using any liferay OOB portlets then you have to customize those OOB portlets CSS as well.
afaik,Direct conversion of css designs into liferay css structure is not possible.
From someone who has a background as a Web Designer who learned Liferay. You need to extend the basic theme and start customizing it. You do this by creating a theme through the liferay SDK. Then it copies all the files into /docroot/diffs/*
In there you will see a css folder, in there you will see a custom.css file, That is the file you want to add your css properties to. It has highest/last priority to set elements and attributes.
If you want to customize the template engine, you need to look at the velocity templates under /docroot/diffs/templates. If you're new to it, make a copy of the file you're playing with so you don't have to blow it all away and start over if you mess up. But basically Velocity is very easy to learn. If you want to embed images directly in velocity from liferay via your theme via the /docroot/diffs/images/custom/ folder, here is a piece of code that will work.
<img src="$themeDisplay.getPathThemeImages()/custom/image_name.png" id="logo" />
I recommend though to keep the portal_normal.vm as similar to the default portal_normal.vm because then upgrading will be easier down the road.

Export Web Content structures and templates in Liferay

Is it possible to export only Web Content structures and/or templates?
Yes, for the most part anyway. If you go into the Control Panel then go into Web Content, you should notice a wrench icon for the portlet. When you go into Export/Import, you can uncheck everything except for the Structures, Templates, and Feeds box. I haven't checked to see if they fixed it yet, but I recall this did not work in 6.0 in the Global community.

how to develop application like LifeRay Control panel

I want to develop an application like LifeRay control panel which has right navigation menu and a page that renders the clicked menu.
My question is how to develop at for example as one portlet or multi portlet taking into considaration (portlet communication)? and how to handle navigation inside portlet?
I'm using Icefaces(JSF) for portlet development and there is a section repeated for other pages(template)
Is there an example in liferay source for this?
Can't you just adjust a theme to have the navigation at the side as opposed to the default (at the top)? This way you'd be developing a plain portal application without any special magic - probably the most intuitive way to go.
Also, others will likely be able to quickly understand what you did and are able to add functionality.

Help on DotNetNuke

Does any body know how can i change the layout of a dotnetnuke website. I need to modify the standard layout
You can use a custom skin or modify the default skin that comes with the DNN installation. The default skin files are in [Website]\Portals_default\Skins\MinimalExtropy\ where [Website] is your DNN web site folder. If you are new to skinning and have a lot of questions, I am sure that the DNN forums will be helpful - DNN Skinning forums
You can do that by editing the CSS. I had similar issue, for which I used " inspect element" in google chrome that helped me in recognizing div elements and css properties. You can find css in portals_default\Skins\DarkKnight (or your own skin name) \skin.css
If your wanting to do anything outside of the CSS (ie, turn off the search bar on a page); then you have to have full access to the site -- open the site via FTP or download all the files, then you can modify the 'default' page, or the skin file you want to change. my suggestion is to make a 'copy' of the skin default page you want to change, give it a new name, and then save it back to the server. When you go to change the 'skin' theme from the 'site manager' you will see your new skin page listed as an option. Modifying from the CMS does not allow you to modify the actual 'page', only its 'parts'. There is also a starter kit available for Visual Studio, google "DNN Starter Kit" which you can create custom modules, skins and containers.

Resources