Forums de discussion

Add the LiveUsers class to the Velocity

Kha N Nguyen, modifié il y a 13 années.

Add the LiveUsers class to the Velocity

Junior Member Publications: 89 Date d'inscription: 22/11/09 Publications récentes
Hi all,

How can I use the com.liferay.portal.liveusers.LiveUsers class in the portal_normal.vm?

I see we have:

1. The com.liferay.portal.velocity.VelocityVariables class, this is where all the objects are injected into the velocity templates.

2. The findService() method:
for example: #set($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))

But, I have no idea yet.

Thanks in advance.
thumbnail
Thiago Leão Moreira, modifié il y a 13 années.

RE: Add the LiveUsers class to the Velocity

Liferay Legend Publications: 1449 Date d'inscription: 10/10/07 Publications récentes
You probably must wrapper this class in a custom velocity tool
Kha N Nguyen, modifié il y a 13 années.

RE: Add the LiveUsers class to the Velocity

Junior Member Publications: 89 Date d'inscription: 22/11/09 Publications récentes
Thiago Leão Moreira:
You probably must wrapper this class in a custom velocity tool


Thanks Thiago,

I have a solution:

- Update the ext-spring.xml to add the bean id: <bean id="com.liferay.portal.liveusers.LiveUsers" class="com.liferay.portal.liveusers.LiveUsers" />

- Update the init_custom.vm to add:
#set ($liveUsersService = $utilLocator.findUtil('com.liferay.portal.liveusers.LiveUsers'))