Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Manish Kumar Jaiswal
how to get structure Name within Templet via velocity
February 12, 2013 5:51 AM
Answer

Manish Kumar Jaiswal

Rank: Regular Member

Posts: 133

Join Date: November 25, 2008

Recent Posts

Is there a way to get structure Name within Template via velocity ?

Regards
Manish
Gnaniyar Zubair
RE: how to get structure Name within Templet via velocity
February 12, 2013 6:21 AM
Answer

Gnaniyar Zubair

Rank: Liferay Master

Posts: 602

Join Date: December 19, 2007

Recent Posts

You can get it through service locator:

#set ($journalStructureService = $serviceLocator.findService('com.liferay.portlet.journal.service.JournalStructureLocalService'))
James Falkner
RE: how to get structure Name within Templet via velocity
February 12, 2013 7:05 AM
Answer

James Falkner

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1196

Join Date: September 17, 2010

Recent Posts

Manish Kumar Jaiswal:
Is there a way to get structure Name within Template via velocity ?

Regards
Manish


This may also work

1#set ($groupId = $getterUtil.getLong($groupId))
2#set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
3#set ($journalStructureLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalStructureLocalService"))
4#set ($curArticle = $journalArticleLocalService.getArticle($groupId, $reserved-article-id.data))
5#set ($curArticleStructure = $journalStructureLocalService.getStructure($groupId, $curArticle.getStructureId()))
6#set ($curArticleStructureName = $curArticleStructure.getName())