简体   繁体   English

在liferay主题中筛选文章的最简单方法是什么

[英]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. 因此,我有一个主题,我只想呈现portlet,跳过任何期刊文章。 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. 在主题的资源中, _diffs/template目录中有一个portlet.vm模板。 This template allows you to override the default presentation of portlets in general (eg change the configuration icons, remove the title bar, ...). 使用此模板,您通常可以覆盖portlet的默认表示形式(例如,更改配置图标,删除标题栏等)。

However, inside portlet.vm Liferay injects a predefined variable called $portletDisplay . 但是,Liferay会在portlet.vm内部注入名为$portletDisplay的预定义变量。 This is an instance of the com.liferay.portal.theme.PortletDisplay class and represents the portlet that is currently printed. 这是com.liferay.portal.theme.PortletDisplay类的实例,代表当前打印的portlet。

You can use the $portletDisplay.portletName attribute to check for 56, which is the ID for all Web Content Display portlets. 您可以使用$portletDisplay.portletName属性检查是否为56,这是所有Web Content Display Portlet的ID。 So, in short, encapsulate the parent <div> inside portlet.vm with the following condition: 因此,简而言之,使用以下条件将父<div>封装在portlet.vm

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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