Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Get url files from a folder id from documents and media in ftl template
تم تعديل Jamie Sammons منذ 3 سنوات من الدقائق.
New Member
المشاركات: 8
تاريخ الإنضمام: 6/9/17
المشاركات الحديثة
Hi guys
I´m trying to show every image stored in a folder of my Documents and media library in a freemarker template DXP 7.3.
So, how can I get every file of that folder? Assuming that in the structure for that template I have a text field to put the folderId or folderUrl that I want to travel in search of it´s child files.
I would really appreciate any help you can offer me.
تم تعديل Gennaro Lippiello منذ 3 سنوات من الدقائق.
Junior Member
المشاركات: 39
تاريخ الإنضمام: 9/3/22
المشاركات الحديثة
Take a look at method getFileEntries of the DLFileEntryLocalService
تم تعديل Jamie Sammons منذ 3 سنوات من الدقائق.
New Member
المشاركات: 8
تاريخ الإنضمام: 6/9/17
المشاركات الحديثة
Thks. I´ll look into it.
تم تعديل Jamie Sammons منذ 3 سنوات من الدقائق.
New Member
المشاركات: 8
تاريخ الإنضمام: 6/9/17
المشاركات الحديثة
I resolved with this code:
<#if folderId.getData()?has_content>
<#assign groupId = themeDisplay.getScopeGroupId()/>
<#assign dlFileEntry = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService") />
<#assign files =dlFileEntry.getFileEntries(groupId,folderId.getData()?number) >
<#list files as item>
<img src="${themeDisplay.getPortalURL() + themeDisplay.getPathContext() + "/documents/" + themeDisplay.getScopeGroupId() + "/" + item.getUuid()}">
<br>
</#list>
</#if>
Hope this get usefull to others..
تم تعديل Tanweer Ahmed Ansari منذ 3 سنوات من الدقائق.
Expert
المشاركات: 322
تاريخ الإنضمام: 11/3/10
المشاركات الحديثة
Hi Ernesto,
Here is how we are doing it in our freemarker templates.
<#assign
dlAppLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppLocalService")
dlFileEntryLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")
folder = dlAppLocalService.getFolder(themeDisplay.getCompanyGroupId(), 0, "FOLDER-NAME")
fileEntries = dlFileEntryLocalService.getFileEntries(themeDisplay.getCompanyGroupId(), folder.getFolderId())
/>
تم تعديل Jamie Sammons منذ 3 سنوات من الدقائق.
New Member
المشاركات: 8
تاريخ الإنضمام: 6/9/17
المشاركات الحديثة
Thnks for your reply!
Community
Company
Feedback