我們的團隊構建了一個自定義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