我目前正在尝试在 Liferay 6.0.5 的布局模板中使用 Portlet,但遇到了一些麻烦。我尝试遵循许多教程,包括 Liferay Wiki 上提供的示例: http://www.liferay.com/community/wiki/-/wiki/Main/Add+runtime+portlets+to+a+layout#section-Add+runtime+portlets+to+a+布局相关+文章。问题是,这些例子都不适合我。对 $processor.processPortlet 的调用什么也不做;我的布局模板生成了一个空单元格。
我的模板中的代码如下:
<div class="columns-1-2" id="main-content" role="main">
#if ($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8)
<table class="portlet-layout">
<tr>
<td class="portlet-column portlet-column-only" id="column-1">
$processor.processPortlet("currentPatient_WAR_opportalweb_INSTANCE_r2Be")
$processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")
</td>
</tr>
</table>
......
#end
</div>
我还应该强调,虽然对此 portlet 的调用是对可实例化自定义 portlet 的调用,但我已经尝试了许多其他类型对非可实例化 portlet 的调用,甚至是 Liferay 的库存portlet:
$processor.processPortlet("tabs_WAR_tabsportlet")
$processor.processPortlet("58")
这些调用都不适合我。
我已经查看了 liferay 日志,并且与此模板、使用此模板加载页面、我的语法等相关的日志中没有错误。我想知道 Liferay 中此特定调用的语法是否已更改6,或者是否需要在我的环境中调整一些设置才能启用此功能?如果对 processPortlet 函数的调用不起作用,我的 Liferay 配置中是否有特定的东西我应该查看以使其起作用?
先感谢您!
I'm currently experimenting with using Portlets in layout templates for Liferay 6.0.5, and I'm having a bit of trouble. I've tried following a number of tutorials, including the examples available on the Liferay Wiki: http://www.liferay.com/community/wiki/-/wiki/Main/Add+runtime+portlets+to+a+layout#section-Add+runtime+portlets+to+a+layout-Related+Articles. The problem is, none of these examples work correctly for me. The calls to $processor.processPortlet do nothing; An empty cell is produced by my layout template.
My code in my template is as follows:
<div class="columns-1-2" id="main-content" role="main">
#if ($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8)
<table class="portlet-layout">
<tr>
<td class="portlet-column portlet-column-only" id="column-1">
$processor.processPortlet("currentPatient_WAR_opportalweb_INSTANCE_r2Be")
$processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")
</td>
</tr>
</table>
......
#end
</div>
I should also stress that although the call to this portlet is to an instance-able custom portlet, I've tried numerous other types of calls to non-instance-able portlets, and even Liferay's stock portlets:
$processor.processPortlet("tabs_WAR_tabsportlet")
$processor.processPortlet("58")
None of these calls work for me.
I've reviewed the liferay logs, and there are no errors in the logs relating to this template, the loading of pages using this template, my syntax, etc. I'm wondering if either the syntax for this particular call has changed in Liferay 6, or if there is some setting I need to adjust in my environment to enable this functionality? If no calls to the processPortlet function work, is there a specific thing in my Liferay configuration that I should look at to make it work?
Thank you in advance!
发布评论
评论(1)
我在您的代码中没有看到任何问题,这应该可以工作。但您可能错过了您处于条件表达式中:
如果您使用 IE6 或 IE7 以外的任何其他语言进行测试,您将看不到条件块的内容
I don't see any problem in your code, this should work. But you might have missed that you're within a conditional expression:
If you're testing this with anything other than IE6 or IE7, you won't see the content of the conditional block