我们的团队构建了一个自定义portlet以将Google标记加载到地图上。标记在模板脚本中创建。我们现在希望在另一个资产发布者中以列表形式显示这些标记。无论如何要根据请求它的portlet将条件传递给模板文件?或者,有没有什么好的方法可以将这些代码构建到jsp中而不是模板文件中?如何在liferay中构建特定于portlet的portlet
//code that creates the markers on the full map
gmarker=new google.maps.Marker({position:new google.maps.LatLng("$Lattitude.getData()","$Longitude.getData()"),title:"$reserved-article-title.getData()",icon:gicon,map:map});
if(window.location.href.indexOf("fullmap") > -1) {
google.maps.event.addListener(gmarker, 'click', function() {
new google.maps.InfoWindow({content:
'<div id="node_content">
<div id="siteNotice"></div>
<h3 id="firstHeading" class="firstHeading">$reserved-article-title.getData(), $City.getData(), $Country.getData()</h3>
<hr class="m_spacer"/>
<div id="bodyContent">
<p class="gdes">$Description.getData()</p>
<img class="m_image" src="$Image.getData()"/>
</div>
</div>'
}).open(map,this);
});
}
gmarker.setMap(map);
//redirect code that opens the infowindow on load if the id paramater is not null
if(flag==true){new google.maps.InfoWindow({content:
'<div id="node_content" class="gs2">
<div id="siteNotice"></div>
<h3 id="firstHeading" class="firstHeading">$reserved-article-title.getData(), $City.getData(), $Country.getData()</h3>
<hr class="m_spacer"/>
<div id="bodyContent">
<p class="gdes">$Description.getData()</p>
<img class="m_image" src="$Image.getData()"/>
</div>
</div>'}).open(map,gmarker);
flag=false;
}
它是liferay 6.1所以我们不会享受最新版本的奢侈品。 Here是两个portlet的屏幕截图以及它们显示的内容以及我们正在瞄准的示例。一个与我们尝试的非常相似的网站可以找到here。希望获得有关如何区分不必编码portlet的概念性想法。非常感激你的帮助。
如果我们找不到解决方案,我们将不得不为每个实例创建两个Web内容资产。这将是非常难以管理的,并且是最后的选择。 – coltonfranco