Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Valerie Lehmann
Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the template?
4 de Dezembro de 2013 02:30
Resposta

Valerie Lehmann

Ranking: New Member

Mensagens: 6

Data de entrada: 25 de Novembro de 2013

Mensagens recentes

I am trying to use NavItem.fromLayouts, but in Liferay 6.2 a third parameter from type Template has been added.

Does anyone know how to retrieve this template so I can use it in this call?
Raghuveer Kanakamedala
RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa
18 de Dezembro de 2013 08:14
Resposta

Raghuveer Kanakamedala

Ranking: New Member

Mensagens: 2

Data de entrada: 29 de Julho de 2013

Mensagens recentes

You might get away by using null instead of third parameter. Don't know if it works in your context. At least give it a shot.
Rautureau Jérôme
RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa
31 de Janeiro de 2014 06:28
Resposta

Rautureau Jérôme

Ranking: Junior Member

Mensagens: 29

Data de entrada: 22 de Fevereiro de 2008

Mensagens recentes

Hi,

No... I have already tried with null but with no success...

Someone ?
M J
RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa
20 de Junho de 2014 06:01
Resposta

M J

Ranking: Regular Member

Mensagens: 175

Data de entrada: 1 de Março de 2013

Mensagens recentes

Did anyone find a solution for the above?
M J
RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa
23 de Junho de 2014 07:56
Resposta

M J

Ranking: Regular Member

Mensagens: 175

Data de entrada: 1 de Março de 2013

Mensagens recentes

Any idea? Anyone? Thanks.
M J
RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa
23 de Junho de 2014 10:53
Resposta

M J

Ranking: Regular Member

Mensagens: 175

Data de entrada: 1 de Março de 2013

Mensagens recentes

Figured it. Here are the codes in case if it helps someone.

In the JSP, put the following code and then you can get the navigation page and sub pages.

1
2  TemplateResource templateResource = new StringTemplateResource("0", "# Placeholder");
3  Template template = TemplateManagerUtil.getTemplate(TemplateConstants.LANG_TYPE_VM, templateResource, false);
4  List<NavItem> navItems = NavItem.fromLayouts(request, layouts, template);
5  for (NavItem navItem : navItems) {
6  ....
7  }
Dustin V Kintanar
RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa
30 de Julho de 2014 18:07
Resposta

Dustin V Kintanar

Ranking: New Member

Mensagens: 3

Data de entrada: 10 de Abril de 2008

Mensagens recentes

Hello All,

I needed to use this method display the navigation items for a given GroupId ($navGroupId) within Velocity. In the case it helps anyone else, the code to do so is below.

Thanks,
Dustin

 1
 2#set($Integer = 0)
 3#set ($mainLayouts = $layoutService.getLayouts($Integer.parseInt($navGroupId), false, 0))   
 4#set($newMainLayouts = [])
 5#foreach ($newLayout in $mainLayouts)
 6    #if($newLayout.isHidden() == false)
 7        #set($temp=$newMainLayouts.add($newLayout))            
 8    #end
 9#end
10
11#set ($navItemClass = $portal.getClass().forName('com.liferay.portal.theme.NavItem'))
12#set ($templateResourceThreadLocal = $portal.getClass().forName('com.liferay.portal.template.TemplateResourceThreadLocal'))
13#set ($templateResource = $templateResourceThreadLocal.getTemplateResource('vm'))
14#set ($templateManagerUtil = $portal.getClass().forName('com.liferay.portal.kernel.template.TemplateManagerUtil'))
15#set ($template = $templateManagerUtil.getTemplate('vm',$templateResource,false))
16#set ($newNavItems = $navItemClass.fromLayouts($request, $newMainLayouts,$template))
17#set ($nav_items = $newNavItems)