Thanks Arnd!<div><br></div><div>Will give it a shot.<br><br><div class="gmail_quote">On Sat, Jun 25, 2011 at 1:26 PM, Arnd Wippermann <span dir="ltr"><<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><u></u>
<div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span>Hi,</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span></span></font> </div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span>if you know the argument "tweet" from your evt.feature,
then the below code should work:</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span></span></font> </div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><div class="im">function onFeatureSelect(evt) <br>{<br> selectedFeature
= evt.feature;<br></div><span> tweet =
...;</span></font></font></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><div class="im">
popup = new
OpenLayers.Popup.FramedCloud(<br>
"chicken",<br>
evt.feature.geometry.getBounds().getCenterLonLat(),<br>
null,<br></div>
popupHTML(tweet), <span>
</span> <span>//returns the html
string</span> <div class="im"><br>
null, true, onPopupClose);<br> evt.feature.popup = popup;
<br> map.addPopup(popup);<br>}<br></div></font></div><span></span><font face="Arial"><font color="#0000ff"><font size="2">Arnd<span></span></font></font></font><br>
<div dir="ltr" lang="de" align="left">
<hr>
<font size="2" face="Tahoma"><b>Von:</b> <a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>
[mailto:<a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>] <b>Im Auftrag von </b>Nicholas
Efremov-Kendall<br><b>Gesendet:</b> Samstag, 25. Juni 2011 18:34<br><b>An:</b>
<a href="mailto:users@openlayers.org" target="_blank">users@openlayers.org</a><br><b>Betreff:</b> [OpenLayers-Users] passing html string
to popup<br></font><br></div><div><div></div><div class="h5">
<div></div>Hi all,
<div><br></div>
<div>I'm currently creating popups and populating their html content with the
following code</div>
<div><br></div>
<div><br></div>
<div>
<div>function onFeatureSelect(evt) </div>
<div>{selectedFeature = evt.feature;</div>
<div>popup = new OpenLayers.Popup.FramedCloud(</div>
<div>"chicken",</div>
<div>evt.feature.geometry.getBounds().getCenterLonLat(),</div>
<div>null,</div>
<div>"<div style='font-size:.8em'>User Name: " +<a href="http://evt.feature.id" target="_blank">evt.feature.id</a> +
"</div>",
</div>
<div>null, true, onPopupClose);evt.feature.popup = popup;
map.addPopup(popup);}</div></div>
<div><br></div>
<div>rather than pull out the attributes myself, I'd like to pass in a preformed
html string via a variable, but I'm not sure how to do this, and I currently
lack a sufficient knowledge of jscript syntax to research this. I can form an
html string via this function but I'm not sure how to pass it back to the popup
function above...</div>
<div><br></div>
<div>
<div>function popupHTML(tweet) {</div>
<div>var retval = '';</div>
<div>retval += '<div class="tweet_info">';</div>
<div>retval += '<img alt="' + tweet.from_user_id + '" src="' +</div>
<div>tweet.profile_image_url + '" class="tweet_profile"/>';</div>
<div>retval += '<h3>' + tweet.from_user + '</h3>';</div>
<div>retval += '<p>' + tweet.text + '</p>';</div>
<div>retval += '<p>Source: <a href="' + tweet.source + '"/>' +</div>
<div>tweet.source + '</a></p>';</div>
<div>retval += '</div>';</div>
<div>return retval;</div>
<div>}</div></div>
<div><br></div>
<div>thanks again in advance...</div></div></div></div>
</blockquote></div><br></div>