Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Chee Chun Liew
$request.attributes.LAYOUT.name doesn't work?
13 de julio de 2010 2:53
Respuesta

Chee Chun Liew

Ranking: New Member

Mensajes: 1

Fecha de incorporación: 21 de abril de 2010

Mensajes recientes

I'm developing structure/template in 5.2 SP4, was trying to get page name where the Web Content is added.

Search around and found out one of the way is digging in $request. After examine the values store in $request, $request.attributes.LAYOUT.name might be a way to pull it off. But I was unable to make it work, $request.attributes.LAYOUT returns the layout object though.

Tried getName(), name(), get("name") too, but no prevail, am I doing anything wrong? Or perhaps there's a different way to get the page name?

Thanks.
Anil Sunkari
RE: $request.attributes.LAYOUT.name doesn't work?
13 de julio de 2010 3:36
Respuesta

Anil Sunkari

Ranking: Expert

Mensajes: 350

Fecha de incorporación: 11 de agosto de 2009

Mensajes recientes

Hi Chee,

I'm developing structure/template in 5.2 SP4, was trying to get page name where the Web Content is added.

Search around and found out one of the way is digging in $request. After examine the values store in $request, $request.attributes.LAYOUT.name might be a way to pull it off. But I was unable to make it work, $request.attributes.LAYOUT returns the layout object though.

Tried getName(), name(), get("name") too, but no prevail, am I doing anything wrong? Or perhaps there's a different way to get the page name?



Page name nothing but Layout name.you can achieve by this way. Try this in Template

#set ($theme_display = $themeDisplay)
#set( $pageName = $themeDisplay.getLayout().getName())

$pageName ..........by printing this you can get current pageName.

Thanks
Anil
Jody Braaten
RE: $request.attributes.LAYOUT.name doesn't work?
3 de noviembre de 2010 14:33
Respuesta

Jody Braaten

Ranking: New Member

Mensajes: 5

Fecha de incorporación: 13 de noviembre de 2008

Mensajes recientes

Hello,

I am having the same problem (5.2.3), and the above solution isn't working for me. Adding $request.attributes.LAYOUT to my template does display the layout values; however, I'm trying to get at the value for the layout field named 'column-2'. Here's the display of my LAYOUT data:

LAYOUT: {plid=99999, groupId=99999, companyId=99999, privateLayout=true, layoutId=999, parentLayoutId=1, name=Assets, title=, description=, type=portlet, typeSettings=layout-template-id=my template 118_INSTANCE_8Cs6_column-1=118_INSTANCE_8Cs6, 118_INSTANCE_Csu6_column-1=118_INSTANCE_Csu6, column-2=56_INSTANCE_p7Tc,56_INSTANCE_7uwL,56_INSTANCE_Pdv5 , hidden=false, friendlyURL=/assets, iconImage=false, iconImageId=0, themeId=, colorSchemeId=, wapThemeId=, wapColorSchemeId=, css=, priority=6, dlFolderId=0}

I have tried so MANY combinations of getting just the column-2 field value that I'm now feeling pretty dense... emoticon I really need to have this done like 'yesterday', so I'd very much appreciate any assistance.

Thanks in advance.
Guillaume B
RE: $request.attributes.LAYOUT.name doesn't work?
29 de noviembre de 2010 2:10
Respuesta

Guillaume B

Ranking: Junior Member

Mensajes: 35

Fecha de incorporación: 15 de junio de 2010

Mensajes recientes

Same issue with Liferay 6.05.

Can't get the friendly url...
Felix J Christy
RE: $request.attributes.LAYOUT.name doesn't work?
29 de noviembre de 2010 2:43
Respuesta

Felix J Christy

Ranking: Regular Member

Mensajes: 106

Fecha de incorporación: 25 de agosto de 2009

Mensajes recientes

Hi,

To access the layout object, you can take the layout id from the following code, and then call the layout service and access the full object.

##take layout id
#set ($layoutId = $request.get("theme-display").get("plid"))

##get the service for layout
#set($layoutService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))

##convert the layout id into long
#set ($layoutLong = $getterUtil.getLong($layoutId))

##take a layout object
#set($layout = $layoutService.getLayout($layoutLong))


To use service locator in vm, you need to override the following property in portal-ext.properties.

journal.template.velocity.restricted.variables=

Thanks,
Felix
Bradley Wood
RE: $request.attributes.LAYOUT.name doesn't work?
16 de febrero de 2011 10:28
Respuesta

Bradley Wood

LIFERAY STAFF

Ranking: Regular Member

Mensajes: 127

Fecha de incorporación: 7 de junio de 2010

Mensajes recientes

I was needing to print the Current Layout ID in my portal_normal.vm

After asking around was able to display with

$layout.getLayoutType().getLayoutTemplateId()

hopefully this helps.
Sagar A Vyas
RE: $request.attributes.LAYOUT.name doesn't work?
14 de septiembre de 2011 0:32
Respuesta

Sagar A Vyas

Ranking: Liferay Master

Mensajes: 581

Fecha de incorporación: 17 de abril de 2009

Mensajes recientes

Hi All,

#set ($layoutId = $request.attributes.LAYOUT)) --> This line working fine with template.

But

#set ($layoutId = $request.attributes.LAYOUT.anyproperties)) --- Does not working emoticon

Can anyone justify ? is this a bug in LIferay 6 sp1.

Thanks,
Sagar Vyas
Aldo De Vleeschauwer
RE: $request.attributes.LAYOUT.name doesn't work?
11 de enero de 2012 4:18
Respuesta

Aldo De Vleeschauwer

Ranking: New Member

Mensajes: 16

Fecha de incorporación: 9 de marzo de 2011

Mensajes recientes

Looks like $request.attributes.LAYOUT is just a string. So you cannot call any properties on it.