Fórum

Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the template?

Valerie Lehmann, modificado 10 Anos atrás.

Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the template?

New Member Postagens: 11 Data de Entrada: 25/11/13 Postagens 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, modificado 10 Anos atrás.

RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa

New Member Postagens: 5 Data de Entrada: 29/07/13 Postagens 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.
thumbnail
Rautureau Jérôme, modificado 10 Anos atrás.

RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa

Junior Member Postagens: 52 Data de Entrada: 22/02/08 Postagens Recentes
Hi,

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

Someone ?
thumbnail
M J, modificado 9 Anos atrás.

RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa

Regular Member Postagens: 184 Data de Entrada: 01/03/13 Postagens Recentes
Did anyone find a solution for the above?
thumbnail
M J, modificado 9 Anos atrás.

RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa

Regular Member Postagens: 184 Data de Entrada: 01/03/13 Postagens Recentes
Any idea? Anyone? Thanks.
thumbnail
M J, modificado 9 Anos atrás.

RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa

Regular Member Postagens: 184 Data de Entrada: 01/03/13 Postagens 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.


  TemplateResource templateResource = new StringTemplateResource("0", "# Placeholder");
  Template template = TemplateManagerUtil.getTemplate(TemplateConstants.LANG_TYPE_VM, templateResource, false);
  List<navitem> navItems = NavItem.fromLayouts(request, layouts, template);
  for (NavItem navItem : navItems) {
  ....
  }

</navitem>
thumbnail
Dustin V Kintanar, modificado 9 Anos atrás.

RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa

New Member Postagens: 5 Data de Entrada: 10/04/08 Postagens 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


#set($Integer = 0)
#set ($mainLayouts = $layoutService.getLayouts($Integer.parseInt($navGroupId), false, 0))   
#set($newMainLayouts = [])
#foreach ($newLayout in $mainLayouts)
	#if($newLayout.isHidden() == false)
		#set($temp=$newMainLayouts.add($newLayout))			
    #end
#end

#set ($navItemClass = $portal.getClass().forName('com.liferay.portal.theme.NavItem'))
#set ($templateResourceThreadLocal = $portal.getClass().forName('com.liferay.portal.template.TemplateResourceThreadLocal'))
#set ($templateResource = $templateResourceThreadLocal.getTemplateResource('vm'))
#set ($templateManagerUtil = $portal.getClass().forName('com.liferay.portal.kernel.template.TemplateManagerUtil'))
#set ($template = $templateManagerUtil.getTemplate('vm',$templateResource,false))
#set ($newNavItems = $navItemClass.fromLayouts($request, $newMainLayouts,$template))
#set ($nav_items = $newNavItems)
thumbnail
Rautureau Jérôme, modificado 8 Anos atrás.

RE: Using NavItem.fromLayouts in Liferay 6.2, how can I retrieve the templa

Junior Member Postagens: 52 Data de Entrada: 22/02/08 Postagens Recentes
@ M J

You save my day !

Thanks