简体   繁体   中英

what is the easiest way to filter articles in liferay theme

Excuse me if I'm asking silly or easy question, but I just can't figure it out. So, I have a theme, I want to render only portlets, skipping any journal articles. Which is the most appropriate way to do it?

In your theme's resources, there is a portlet.vm template available in the _diffs/template directory. This template allows you to override the default presentation of portlets in general (eg change the configuration icons, remove the title bar, ...).

However, inside portlet.vm Liferay injects a predefined variable called $portletDisplay . This is an instance of the com.liferay.portal.theme.PortletDisplay class and represents the portlet that is currently printed.

You can use the $portletDisplay.portletName attribute to check for 56, which is the ID for all Web Content Display portlets. So, in short, encapsulate the parent <div> inside portlet.vm with the following condition:

#if($portletDisplay.portletName == '56')
<div class="portlet" ...>
    ...
</div>
#end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM