WXforum.net
Web Weather => Weather Website PHP/AJAX scripting => Topic started by: SkiMedicKC on May 15, 2012, 12:51:39 AM
-
I am trying to create a link to the Wundermap from my drop-down radar links...but I keep getting an error that blocks my entire website from loading:
XML error: EntityRef: expecting ';' at line 40
The link I want to create is to:
http://www.wunderground.com/cgi-bin/findweather/getForecast?brand=wxmap&query=39.02179,-94.48965&lat=39.02179&lon=-94.48965&zoom=11&type=terrain&units=english&rad=0&sat=0&svr=0&cams=0&tor=0&wxsn=1&wxsn.mode=temp&ib=0&mits=0
In flyout-menu.xml, I created the following line at line 40 within the radar dropdowns:
<item caption="Wundermap" link="http://www.wunderground.com/cgi-bin/findweather/getForecast?brand=wxmap&query=39.02179,-94.48965&lat=39.02179&lon=-94.48965&zoom=11&type=terrain&units=english&rad=0&sat=0&svr=0&cams=0&tor=0&wxsn=1&wxsn.mode=temp&ib=0&mits=0"/>
I would think the line above would send the viewer directly to the Wundermap page and off of my site. What am I doing wrong?
Also, how do I get the link to open in a new window rather than totally leaving my site?
Thanks!!
-
Tricky stuff, that XML.. in the link="..." section, replace each '&' with '&amp;' for each occurrence. XML hates 'naked' ampersands. The '&amp;' will be changed in the XML parser to '&' in the actual link produced, and the Wunderground webserver will interpret all the resulting '&' as '&' and be happy.
Add to the <item ... entry a target="_blank" and the link created will launch on a new page.
So, the reformatted entry is <item caption="Wundermap" target="_blank" link="http://www.wunderground.com/cgi-bin/findweather/getForecast?brand=wxmap&amp;query=39.02179,-94.48965&amp;lat=39.02179&amp;lon=-94.48965&amp;zoom=11&amp;type=terrain&amp;units=english&amp;rad=0&amp;sat=0&amp;svr=0&amp;cams=0&amp;tor=0&amp;wxsn=1&amp;wxsn.mode=temp&amp;ib=0&amp;mits=0"/>
Hope this helps...
Best regards,
Ken
-
It worked perfectly!!! \:D/
Thanks Ken, you're ever so helpful...as always!!
cps