<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19088"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=171302118-25062011>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=171302118-25062011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=171302118-25062011>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
class=171302118-25062011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT
size=2>function onFeatureSelect(evt) <BR>{<BR> selectedFeature
= evt.feature;<BR><SPAN class=171302118-25062011> tweet =
...;</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
popup = new
OpenLayers.Popup.FramedCloud(<BR>
"chicken",<BR>
evt.feature.geometry.getBounds().getCenterLonLat(),<BR>
null,<BR>
popupHTML(tweet), <SPAN
class=171302118-25062011>
</SPAN> <SPAN class=171302118-25062011>//returns the html
string</SPAN> <BR>
null, true, onPopupClose);<BR> evt.feature.popup = popup;
<BR> map.addPopup(popup);<BR>}<BR></FONT></DIV><SPAN
class=171302118-25062011></SPAN><FONT face=Arial><FONT color=#0000ff><FONT
size=2>Arnd<SPAN class=171302118-25062011></SPAN></FONT></FONT></FONT><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Nicholas
Efremov-Kendall<BR><B>Gesendet:</B> Samstag, 25. Juni 2011 18:34<BR><B>An:</B>
users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] passing html string
to popup<BR></FONT><BR></DIV>
<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></BODY></HTML>