Publisher Templates Code for Getting Article Small Url in liferay 6.2

Liferay 6.2, comes with concept “Application Display Templates”,  WithApplication Display Templates, you can define custom display templates used to render asset-centric applications. Let ‘s try simple example:

#if (!$entries.isEmpty())  
   #foreach ($curEntry in $entries)  
     $curEntry.getTitle($locale)  
     $dateTool.format("dd MMM yyyy",  
  $dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", $curEntry.getPublishDate()), $locale)  
     
  
     #end  

Thus, you can customize view of Asset Publisher portlet. This will help in getting latest news, etc. Like built in display style “Abstract” shows Article Title, abstract small image, abstract summary.

How to get small image url and put into the application Dispaly Templates? Let’s try this example:

#if (!$entries.isEmpty())
#foreach ($curEntry in $entries)
#set($renderer = $curEntry.getAssetRenderer() )
#set($className = $renderer.getClassName() )

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

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


 $curEntry.getTitle($locale) 




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




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

$renderer.getSummary($locale)





#end
#end
#end

 and you get this:

You can modify more to get beautiful template to show slide news or etc

Leave a Reply

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