掲示板

Embedding a custom portlet in a custom theme

thumbnail
8年前 に William Gosse によって更新されました。

Embedding a custom portlet in a custom theme

Liferay Master 投稿: 533 参加年月日: 10/07/04 最新の投稿
Hi, I've some articles on how put a custom portlet in a custom theme out on the web but they seemed a little dated. I was hoping that some one would have some current information on how this can be done.
thumbnail
8年前 に Olaf Kock によって更新されました。

RE: Embedding a custom portlet in a custom theme

Liferay Legend 投稿: 6396 参加年月日: 08/09/23 最新の投稿
It'd be good to know what you already read - the basic technique didn't change a lot, it might still be accurate. Or did you try it and it didn't work?
thumbnail
8年前 に William Gosse によって更新されました。

RE: Embedding a custom portlet in a custom theme

Liferay Master 投稿: 533 参加年月日: 10/07/04 最新の投稿
Here's two I found:
http://www.liferay.com/community/forums/-/message_boards/message/34749078
https://www.liferay.com/community/forums/-/message_boards/message/16646210
thumbnail
8年前 に Travis Cory によって更新されました。

RE: Embedding a custom portlet in a custom theme

Junior Member 投稿: 73 参加年月日: 13/06/04 最新の投稿
Hello William,

I'd take a look at the DOM to see what the proper portletID is. I've followed the following pattern

#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($custom_portlet = '[portlet-name]_WAR_[name]')

$theme.runtime($custom_portlet, '', $velocityPortletPreferences.toString())

Where, "portlet-name" is pulled from the custom portlet liferay-portlet.xml, and, "name" is pulled from the name of the portlet. As I said initially inspecting the DOM can be very useful in determining how to import the custom portlet.
thumbnail
8年前 に William Gosse によって更新されました。

RE: Embedding a custom portlet in a custom theme

Liferay Master 投稿: 533 参加年月日: 10/07/04 最新の投稿
Ok this is sort of working except for when I change pages it looks like I have two different instances of the same portlet. I wnat one single instance across all pages. I'm using JSF, speicifcally Primefaces, with SessionScope, but I'm not seeing my current values when maintianed when I go from one page to another.
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Embedding a custom portlet in a custom theme

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
William Gosse:
I'm using JSF, speicifcally Primefaces, with SessionScope, but I'm not seeing my current values when maintianed when I go from one page to another.


Just because it is session scoped that doesn't mean that changes on the front end will be persisted to the session for you.

Session scope will be updated if you invoke an action on your portlet, not on someone else's.

What I usually do in this case is manage state using AJAX. A change in the browser gets pushed to the back so the session can be updated regardless of what else a user submits on.
thumbnail
8年前 に William Gosse によって更新されました。

RE: Embedding a custom portlet in a custom theme

Liferay Master 投稿: 533 参加年月日: 10/07/04 最新の投稿
I am calling ajax actions to to persist my changes. The issue seems to be that that even though its on portlet embedded in theme its actually different instances per page
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Embedding a custom portlet in a custom theme

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
Yeah, that's likely. Even though it may not be instantiable, different pages would translate into different instances.

Can you persist in the DB perhaps?

Like dockbar, for example, would also be on different pages and likely different instances, but they don't really have any session scoped data it's all based on what's available in the current context.
thumbnail
8年前 に Travis Cory によって更新されました。

RE: Embedding a custom portlet in a custom theme

Junior Member 投稿: 73 参加年月日: 13/06/04 最新の投稿
Hey William,

If you look at this page it appears you can specify an instance id for the portlet. Give that a shot! Good luck!
thumbnail
8年前 に William Gosse によって更新されました。

RE: Embedding a custom portlet in a custom theme

Liferay Master 投稿: 533 参加年月日: 10/07/04 最新の投稿
So I did get this working with the following code in my portal_normal.vm:
<div class="moasisaccountheader">
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($custom_portlet = 'accountssearch_WAR_MoasisAgencyportlet')

$theme.runtime($custom_portlet, '', $velocityPortletPreferences.toString())
</div>

添付ファイル:

8年前 に karthik reddy によって更新されました。

RE: Embedding a custom portlet in a custom theme

Junior Member 投稿: 60 参加年月日: 13/04/08 最新の投稿
Hi William,
Hope so your code is working fine just for reference you can check this link Custom portlet in theme