shabunc
shabunc

Reputation: 24741

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?

Upvotes: 0

Views: 308

Answers (1)

p.mesotten
p.mesotten

Reputation: 1402

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 (e.g. 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

Upvotes: 1

Related Questions