掲示板

Liferay 6.2 How to get ThemeDisplay object in cms template

10年前 に Muhammad Taha によって更新されました。

Liferay 6.2 How to get ThemeDisplay object in cms template

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
Hi all,
I'm using Liferay 6.2, I'm trying to get ThemeDisplay object in template for loading another webcontent. The below code is working in 6.1 but not working in 6.2. can anyone help me in this??

#set ($serviceContext = $portal.getClass().forName("com.liferay.portal.service.ServiceContextThreadLocal").getServiceContext())
#set ($httpServletRequest = $serviceContext.getRequest())
#set ($objThemeDisplay = $httpServletRequest.getAttribute("THEME_DISPLAY"))
$journalContentUtil.getContent($getterUtil.getLong($groupId), '11701', 'view', $request.theme-display.language-id,$objThemeDisplay)


Thanks
Taha
thumbnail
10年前 に Zsigmond Rab によって更新されました。

RE: Liferay 6.2 How to get ThemeDisplay object in cms template (回答)

Liferay Master 投稿: 728 参加年月日: 10/01/05 最新の投稿
Hi Muhammad,

are you sure it's working in 6.1? Actually, there are some object which cannot be reached from a CMS template. See: https://www.liferay.com/community/wiki/-/wiki/Main/Access+Objects+from+Velocity#section-Access+Objects+from+Velocity-CMS+Templates

It's true in all of the versions because of the description there.

However, there is an other method which you can use:

$journalContentUtil.getContent(long groupId, String articleId, String ddmTemplateKey, String viewMode, String languageId, String xmlRequest)

Just change the themeDisplay object to the xmlRequest object.

Regards,
Zsigmond
10年前 に Muhammad Taha によって更新されました。

RE: Liferay 6.2 How to get ThemeDisplay object in cms template

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
Hi Rab, yes its working in 6.1. your solution is perfect. Thank you!