Foros de discusión

Journal Content and Velocity - VM - Template

Mariano Cifre, modificado hace 15 años.

Journal Content and Velocity - VM - Template

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
Hi guys,

I am trying to get all the articles (for now) using Templates.

I found this two interesting articles in the wiki:
Journal Internal API and
Journal Template (Velocity) but I can't find a way to get all the articles.

I downloaded the bundle, and opened all the Journal Templates of the guest community, but the only one who handle articles were processed using XSL, and not VM.


I tryied to use the following code:
#set ($targetPortletID = "56")
#foreach ($article in $articles)
    #set ($articleUrl = "/web/guest/news/-/journal_content/" + $targetPortletID + "/" + $article.groupId +  "/" + $article.articleId)
    <h3>$article.title</h3>
    <span>$article.userName</span>
    <p>$article.description</p>
    <a href="${articleUrl}">Read More...</a>
#end


Does anyone know how to actually set the "$articles" using velocity?

Thanks in advance,
Mariano.
Mariano Cifre, modificado hace 15 años.

RE: Journal Content and Velocity - VM - Template

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
Hi guys,

Unfortunately I didn't find the answer, but just in case you are trying to do the same, I encourage you to use the Asset Publisher.

We changed it adding a FriendlyURLMapper and took the advantage of the paging. The paging a feature hard to do with the API provided to use the Journal Template whether you are using VM or XSL as a Language Type.

Hope it helps,

Mariano.
Roberto Tellado, modificado hace 14 años.

RE: Journal Content and Velocity - VM - Template

Regular Member Mensajes: 245 Fecha de incorporación: 15/09/09 Mensajes recientes
Hi,

You can access to the articles with a services. JournalArticleLocalService.

#set ($longGroupId = $getterUtil.getLong($groupId))
#set ($servieArticles= $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil"))
#set ($articles = $servieArticles.getXXXXXX())


I hope to help you.

Bye.