Newest Webcontent Portlet in Liferay 6.2

Why we have to write a new portlet to display newest article in liferay while we have a powerful portlet Asset Publisher? How to make Asset Publisher show the newest article in beautiful way? It’s luckily because of asset publisher template. We use asset publisher template to change the way it display and what to display. Try this template:

##
## This template can be used to modify the look of a specific
## application.
##
## Please use the left panel to quickly add commonly used variables.
## Autocomplete is also available and can be invoked by typing “$”.
##

#if (!$entries.isEmpty())
#set($curEntry = $entries.get(0) )

#set($renderer = $curEntry.getAssetRenderer() )
#set($className = $renderer.getClassName() )

#if( $className == “com.liferay.portlet.journal.model.JournalArticle” )

#set( $Article = $renderer.getArticle() )

#if( $Article.getArticleImageURL($themeDisplay) )
#set( $image = $Article.getArticleImageURL($themeDisplay) )

#else
#set( $image = “” )
#end 

$curEntry.getTitle($locale)

$renderer.getSummary($locale)

$curEntry.getCreateDate()

#end
#end

If you don’t know how to use this tempalte, please insert new asset publisher, then choose the menu configuration, display setting tab, and choose the template. If you insert new template here, please refresh the page before choose it. I use this template for 3 asset publisher portlets in 3 columns. These articles must have small image in the abstract menu. and result here:

Hope this help you, I will give more templates in next tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *