如何使用Velocity模板将现有portlet添加到Web Content Display

use*_*543 3 liferay liferay-6 liferay-theme liferay-velocity

我想创建一个使用新页面Web Content DisplayVelocity TemplatesStructures.

在我的页面上,我希望有多个选项卡,并且每个选项卡上需要以编程方式从现有portlet的模板添加.

我知道如何将现有的portlet添加到我的主题,($theme.runtime("portlet_id"))但我找不到将portlet添加到速度模板的方法,因为$theme对象在Web内容显示模板中不可用.

你能否告诉我是否可以在模板中添加一个portlet?
如果有,怎么样?

谢谢.

小智 6

您可以在velocity模板中使用runtime-portlet标记:

<div id="portlet-inside-wc">
  <runtime-portlet name="portlet-id" instance="instanceID" queryString=""/>
</div>
Run Code Online (Sandbox Code Playgroud)

其中name是portlet ID,instance是4个字母的唯一(Alpha Numeric)字,Querystring可以是portlet首选项.