WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: SkiMedicKC on May 15, 2012, 12:51:39 AM

Title: Link to Wundermap
Post 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!!
Title: Re: Link to Wundermap
Post by: saratogaWX on May 15, 2012, 01:34:23 AM
Tricky stuff, that XML.. in the link="..." section, replace each '&' with '&amp;amp;' for each occurrence.  XML hates 'naked' ampersands.  The '&amp;amp;' will be changed in the XML parser to '&amp;' in the actual link produced, and the Wunderground webserver will interpret all the resulting '&amp;' 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
Code: [Select]
<item caption="Wundermap" target="_blank" link="http://www.wunderground.com/cgi-bin/findweather/getForecast?brand=wxmap&amp;amp;query=39.02179,-94.48965&amp;amp;lat=39.02179&amp;amp;lon=-94.48965&amp;amp;zoom=11&amp;amp;type=terrain&amp;amp;units=english&amp;amp;rad=0&amp;amp;sat=0&amp;amp;svr=0&amp;amp;cams=0&amp;amp;tor=0&amp;amp;wxsn=1&amp;amp;wxsn.mode=temp&amp;amp;ib=0&amp;amp;mits=0"/>

Hope this helps...

Best regards,
Ken
Title: Re: Link to Wundermap
Post by: SkiMedicKC on May 15, 2012, 10:56:00 AM
It worked perfectly!!!     \:D/

Thanks Ken, you're ever so helpful...as always!!

cps