Web content displays all files in the document library

I am trying to use web content display to display all files in a specific document library folder.

I would like to save the folder selection setting.

Do you know if there is a dynamic element in the template that points to a folder not for a specific field in the document library?

If not possible, does anyone know another way to do this?

early

Sabrina

+4
source share
2 answers

You can create a structure that contains a text box for folderId named "folderId".

How to create a template

#set($service = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService")) #set($gid = $getterUtil.getLong($request.get("theme-display").get("scope-group-id"))) #set($fid = $getterUtil.getLong($folderId.getData())) #set($files = $service.getFileEntries($gid, $fid)) #foreach($doc in $files) #set($uet = $httpUtil.encodeURL($htmlUtil.unescape($doc.getTitle()))) <a href="/documents/$gid/$fid/$uet">$doc.getTitle()</a><br /> #end 

Create an article on this template / structure and enter the identifier of the folder that you want to display. Add the Web Content portlet that displays this article.

UPDATE:

For Liferay 6.1, the method signature was changed and

 List<DLFileEntry> getFileEntries(long groupId, long folderId, int start, int end, OrderByComparator obc) 

So for liferay 6.1 you have to change the call at least

 #set($files = $service.getFileEntries($gid, $fid, -1, -1, null)) 

or change to start / end / sort.

+1
source

To accomplish this, you can use the document library display portlet.

-one
source

Source: https://habr.com/ru/post/1397024/


All Articles