Forums de discussion
Display articles from web content folder (asset pulisher)
Dmitry Sergeev, modifié il y a 8 années.
Display articles from web content folder (asset pulisher)
Junior Member Publications: 34 Date d'inscription: 08/11/11 Publications récentes
Hi liferay gurus,
is there a way to display articles from a certain web content folder? I couldn't find it, but I still hope it's possible, just not obvious.
I use LR 6.2 CE GA4.
Thanks!
is there a way to display articles from a certain web content folder? I couldn't find it, but I still hope it's possible, just not obvious.
I use LR 6.2 CE GA4.
Thanks!
Aravinth Kumar, modifié il y a 8 années.
RE: Display articles from web content folder (asset pulisher)
Regular Member Publications: 152 Date d'inscription: 26/06/13 Publications récentes
Hi,
If you are looking for API
JournalArticleLocalServiceUtil.getArticles(groupId, folderId);
If you are looking for API
JournalArticleLocalServiceUtil.getArticles(groupId, folderId);
Dmitry Sergeev, modifié il y a 8 années.
RE: Display articles from web content folder (asset pulisher)
Junior Member Publications: 34 Date d'inscription: 08/11/11 Publications récentes
Thanks, but unfortunately I'm looking for a way to do it with AssetPublisher configuration, not API.
But I'm starting to get a feeling that I will have to do it programmatically
But I'm starting to get a feeling that I will have to do it programmatically
Aravinth Kumar, modifié il y a 8 années.
RE: Display articles from web content folder (asset pulisher)
Regular Member Publications: 152 Date d'inscription: 26/06/13 Publications récentes
Hi,
Dont know.whether this will help you.Just give a try with this configuration
Then In asset publisher configuration
Under asset selection tab choose manual
Then under that asset entries select web content folder choose the folder you want.
Dont know.whether this will help you.Just give a try with this configuration
Then In asset publisher configuration
Under asset selection tab choose manual
Then under that asset entries select web content folder choose the folder you want.
Dmitry Sergeev, modifié il y a 8 années.
RE: Display articles from web content folder (asset pulisher)
Junior Member Publications: 34 Date d'inscription: 08/11/11 Publications récentes
Yes, I've tried that. AP displays folder itself, not articles from the folder.
Emma Liu, modifié il y a 8 années.
RE: Display articles from web content folder (asset pulisher)
New Member Publications: 9 Date d'inscription: 29/03/12 Publications récentes
Hi Dmitry,
As far as I know, this might not be possible for now without customization. You may try voting this ticket: LPS-53044.
Regards,
Emma
As far as I know, this might not be possible for now without customization. You may try voting this ticket: LPS-53044.
Regards,
Emma
Dmitry Sergeev, modifié il y a 8 années.
RE: Display articles from web content folder (asset pulisher)
Junior Member Publications: 34 Date d'inscription: 08/11/11 Publications récentes
Thanks, Emma!
Freddy Yang, modifié il y a 7 années.
RE: Display articles from web content folder (asset pulisher)
New Member Envoyer: 1 Date d'inscription: 09/09/16 Publications récentes
I still need this function for my app, and I searched, here is the solution, hope it will be helpful for some guys:
(You should replace the folderID with what you want.)
The matched Java Code:
Regards
(You should replace the folderID with what you want.)
<#assign folderId = staticUtil["java.lang.Long"]>
<#assign folderId=folderId.valueOf("23826")>
<#assign groupId = themeDisplay.getSiteGroupId()>
<#assign journalArticleLocalServiceUtil = staticUtil["com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"]>
<#assign journalArticleClazz = staticUtil["com.liferay.portal.kernel.util.ClassResolverUtil"].resolveByPortalClassLoader("com.liferay.portlet.journal.model.JournalArticle")>
<#assign dynamicQueryFactoryUtil = objectUtil("com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil")>
<#assign portalClassLoader = objectUtil("com.liferay.portal.kernel.util.PortalClassLoaderUtil")>
<#assign propertyFactoryUtil = objectUtil("com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil")>
<#assign orderFactoryUtil = objectUtil("com.liferay.portal.kernel.dao.orm.OrderFactoryUtil")>
<#assign projectionFactoryUtil = objectUtil("com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil")>
<#assign maxVersionArticle_dq = dynamicQueryFactoryUtil.forClass(journalArticleClazz,"maxVersionArticle")>
<#assign VOID1 = maxVersionArticle_dq.add(propertyFactoryUtil.forName("articleId").eqProperty("articleByType.articleId"))>
<#assign VOID1 = maxVersionArticle_dq.setProjection(projectionFactoryUtil.max("id"))>
<#assign articleByType_dq = dynamicQueryFactoryUtil.forClass(journalArticleClazz,"articleByType")>
<#assign VOID2 = articleByType_dq.add(propertyFactoryUtil.forName("id").eq(maxVersionArticle_dq))>
<#assign VOID2 = articleByType_dq.add(propertyFactoryUtil.forName("folderId").eq(folderId))>
<#assign VOID2 = articleByType_dq.add(propertyFactoryUtil.forName("groupId").eq(groupId))>
<#assign VOID2 = articleByType_dq.addOrder(orderFactoryUtil.desc("modifiedDate"))>
<#assign articles = journalArticleLocalServiceUtil.dynamicQuery(articleByType_dq)>
<#if articles?has_content>
<#list articles as journalArticle>
<div>${journalArticle.titleCurrentValue}</div>
<!--#list-->
<!--#if-->
The matched Java Code:
List<journalarticle> articleList = null;
try {
//OrderByComparator obc = new ArticleModifiedDateComparator(false);
//articleList = JournalArticleLocalServiceUtil.getArticles(groupId, folderId, start, end, obc);
DynamicQuery maxVersionArticle = DynamicQueryFactoryUtil
.forClass(JournalArticle.class, "maxVersionArticle", PortalClassLoaderUtil.getClassLoader())
.add(PropertyFactoryUtil.forName("articleId").eqProperty("articleByType.articleId"))
.setProjection(ProjectionFactoryUtil.max("id"));
// articleByType : Query will find the articles by its type and
// appended the maxVersionArticle query so it will track only latest versions
DynamicQuery articleByType = DynamicQueryFactoryUtil
.forClass(JournalArticle.class, "articleByType", PortalClassLoaderUtil.getClassLoader())
.add(PropertyFactoryUtil.forName("id").eq(maxVersionArticle))
.add(PropertyFactoryUtil.forName("folderId").eq(folderId))
.add(PropertyFactoryUtil.forName("groupId").eq(groupId))
.addOrder(OrderFactoryUtil.desc("modifiedDate"));
articleByType.setLimit(start, end);
articleList = (List<journalarticle>) JournalArticleLocalServiceUtil.dynamicQuery(articleByType);
} catch (SystemException e) {
e.printStackTrace();
}
</journalarticle></journalarticle>
Regards