-
How to set portlet preference in theme?
Liferay provides a built-in VM variable called$velocityPortletPreferences for this purpose.$velocityPortletPreferences is a Map<String, String>. For each preference, pass its key string plus the value you desire. The key may be one of Liferay’s built-in portlet preference keys, or (for plugin portlets) one of your own that your portlet knows how to interpret.
#set ($VOID = $velocityPortletPreferences.setValue(‘display-style’, ‘1’))
#set ($VOID = $velocityPortletPreferences.setValue(‘portlet-setup-show-borders’, ‘false’))}}} -
Explain theme folder structure?
init_custom.vm Allows you to add custom Velocity variables.
init.vm : This holds default velocity variables
navigation.vm Implements the page navigation within the theme.
portal_normal.vm : Controls the look & feel of the portal template for normal pages. This file includes the other files.
portal_pop_up.vm Controls the look & feel of the portal templates for pop-ups. This is used to show a portlet when its window state is equal to LiferayWindowState.POP_UP
portlet.vm The template for portlet windows within the theme.
-
What file theme developers need to update the custom css styles? ANS : custom.css
-
How to access custom portlet service layer in theme?
- $serviceLocator.findService is used to load services (service folder classes service.jar) into theme velocity template
Click here to access Liferay Service in Liferay theme Velocity Template
This tutorial will give light on accessing Liferay Services and Utilities at theme level. Liferay provides init_custom.vm file to hold custom…READ MORE
- $serviceLocator.findService is used to load services (service folder classes service.jar) into theme velocity template
-
How to access util tag lib in Theme velocity templates?
- $utilLocator.findUtil() is used to load util classes (util package classes in service.jar) into liferay theme velocity template
-
How to embed a portlet in theme ?
- Ans : $theme.runtime(“test_war_testportlet”)
- $theme.runtime($myPortletId, $queryString, $velocityPortletPreferences.toString())
- Ans : $theme.runtime(“test_war_testportlet”)
-
What is Layout Template?
- Layout templates are used to control portlets are displayed on UI like grid or column structure
- layout template are created using layout plugin type and need to design on {name}-template.tpl file
-
How to get Theme Settings in JSP?
- by using theme display object, we can get theme settings
- themeDisplay.getThemeSetting(“key”)
- by using theme display object, we can get theme settings
-
In Liferay theme, How to serve theme static content from Apache ?
- by setting virtual-path in liferay-look-and-feel.xml file . The virtual-path value sets the virtual path used to fetch the CSS, images, and JavaScript files. By default, the portal returns the theme’s servlet path. This setting allows you to override it. For example, suppose your theme is deployed to the servlet path “/test-theme” and your theme image-path is “/xyz/images”. By default, the portal
will return “/test-theme/xyz/images” for the path of the theme’s images. You can override it by setting virtual-
path to “/virtual” and have the portal return “/virtual/xyz/images”. This is useful when you want all static files to
be served by Apache for better performance. The default value is “” which means this is not used. -
<theme id="professor" name="Professor" > <virtual-path>res</virtual-path> <settings> <setting key="portlet-setup-show-borders-default" value="false"></setting> </settings> </theme>
- by setting virtual-path in liferay-look-and-feel.xml file . The virtual-path value sets the virtual path used to fetch the CSS, images, and JavaScript files. By default, the portal returns the theme’s servlet path. This setting allows you to override it. For example, suppose your theme is deployed to the servlet path “/test-theme” and your theme image-path is “/xyz/images”. By default, the portal
-
How to embed web content at theme level?
- Using FM:
-
<#assign groupId = themeDisplay.getScopeGroupId()> <#assign journalArticleLocalService = serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService")> <#assign journalArticle = journalArticleLocalService.getLatestArticleByUrlTitle(themeDisplay.getScopeGroupId(), "hello", 0)> <#assign journPortletIns = "56_INSTANCE_A1HSJX1" /> <#assign PortletPreferencesFactoryUtil = staticUtil["com.liferay.portlet.PortletPreferencesFactoryUtil"] /> <#assign portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, journPortletIns) /> <#assign temp = portletSetup.setValue("portletSetupShowBorders", "false") /> <#assign temp = portletSetup.setValue("groupId",groupId) /> <#assign temp = portletSetup.setValue("articleId", journalArticle.getArticleId()) /> <#assign temp = portletSetup.store() /> ${theme.runtime(journPortletIns, "", portletSetup.toString())}
- or you can print the content:
-
<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService") > <#assign footerContent= journalArticleLocalService.getLatestArticleByUrlTitle(themeDisplay.getScopeGroupId(), "hello", 0)> ${journalContentUtil.getContent(groupId, footerContent.getArticleId(), "", locale.toString(), themeDisplay)}
-
-
- Using FM:
-
What is recommended way to disable borders of all portlets?
Ans : Using theme settings as below
<look-and-feel>
<compatibility>
<version>6.1.10+</version>
</compatibility>
<theme id=”sample-theme” name=”Sample Theme”>
<settings>
<setting key=”portlet-setup-show-borders-default” value=”false” />
</settings>
</theme>
</look-and-feel>Note:- By default its true. we must have to explicitly set it to false.
-
How To embed a portlet in layout
Ans : $processor.proceePortlet(“3”)
-
How to disable dockbar ?
- we can disable the dockbar with below code:
-
#if ($is_signed_in) #dockbar() #end
- How to implement color schemes in Liferay themes?
-
How to resolve CSS conflict issue with Liferay AUI css when we incorporate 3rd party css?
-
Check this Tutorial : Liferay theme CSS conflict issues
Liferay theme CSS conflict issues tutorial gives solution for CSS conflict issues in Liferay theme. In general, Liferay applications are required to use custom css such as bootstrap plugins. etc, but Liferay it self used…READ MORE
-