留言板

How get name of portlet

Adrian Pol,修改在7 年前。

How get name of portlet

Junior Member 帖子: 49 加入日期: 17-3-14 最近的帖子
I want to display the detail of one article, and i want the name of this article for example:

http://localhost:8080/web/web-test/ofertas/-/asset_publisher/xLxPkbeLt8IB/content/new-york

the name is new-york

i can use $curEntry.getTitle($locale) and replace the space for '-' but when the client change the name of the article for example NewYork the name it's still new-york but getTitle return NewYork and i cant do that...

How can get this identificator "new-york"?
thumbnail
Danielle Ardon,修改在7 年前。

RE: How get name of portlet (答复)

Junior Member 帖子: 37 加入日期: 16-6-6 最近的帖子
This identifier is the url title of the content, which is used to create direct display links for journalarticles.
This is a specific property for journalarticles ( see also https://docs.liferay.com/portal/6.2/javadocs-all/com/liferay/portlet/journal/model/JournalArticleModel.html#getUrlTitle() )

You best best is to retrieve the article from the renderer, and then retrieve the url title
This is for 6.2, check whether the fully qualified classname of journalarticle is still the same in 7 if you are using 7.

#foreach ( $entry in $entries )
	#set ( $renderer = $entry.getAssetRenderer() )
        #set ( $className = $renderer.getClassName() )

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

            ## ARTICLE PROPERTIES

            #set ( $article = $renderer.getArticle() )
            #set ( $urlTitle = $article.getUrlTitle() )
        #end ## class
#end ## each
Adrian Pol,修改在7 年前。

RE: How get name of portlet

Junior Member 帖子: 49 加入日期: 17-3-14 最近的帖子
it works! emoticon thank you emoticon