Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

embed a portlet via js

View resource.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#set ($articleService = $portal.getClass().forName('com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil'))
#set ($article = $articleService.getArticle($getterUtil.getLong($groupId), $reserved-article-id.data))
 
$le-content.data
 
<div id="${request.portlet-namespace}discussion">
 
<script type="text/javascript">
AUI().use('liferay-portlet-url', 'aui-resize-iframe', function(A) {
var portletURL = Liferay.PortletURL.createRenderURL();
portletURL.setPortletId('1_WAR_mypluginportlet');
portletURL.setPlid(themeDisplay.getPlid())
portletURL.setResourceId('/my.jsp');
portletURL.setParameter('param1', value1);
var html = '<iframe frameborder="0" id="${request.portlet-namespace}discussion_frame" src="' + portletURL.toString() + '" scrolling="no" width="100%"></iframe>';
A.one('#${request.portlet-namespace}discussion').append(html);
A.one('#${request.portlet-namespace}discussion_frame').plug(A.Plugin.ResizeIframe);
});
</script>
View resource.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<div id="${request.portlet-namespace}discussion"></div>
 
<script type="text/javascript">
AUI().use('liferay-portlet-url', 'aui-resize-iframe', function(A) {
var portletURL = Liferay.PortletURL.createResourceURL();
portletURL.setPortletId('discussionwidget_WAR_discussionwidgetportlet');
portletURL.setWindowState('pop_up');
portletURL.setParameter('className', 'com.liferay.portlet.journal.model.JournalArticle');
portletURL.setParameter('classPK', '${article.getResourcePrimKey()}');
portletURL.setParameter('subject', '${htmlUtil.escape($reserved-article-title.data)}');
var html = '<iframe frameborder="0" id="${request.portlet-namespace}discussion_frame" src="' + portletURL.toString() + '" scrolling="no" width="100%"></iframe>';
A.one('#${request.portlet-namespace}discussion').append(html);
A.one('#${request.portlet-namespace}discussion_frame').plug(A.Plugin.ResizeIframe);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.