Author Topic: Fly-out menu Question  (Read 886 times)

0 Members and 1 Guest are viewing this topic.

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Fly-out menu Question
« on: July 22, 2015, 09:05:11 AM »
Hi,

http://www.pennlake.us/

OK -- I am trying to add another item to my page above,  Navigation- Radar.  Under Radar I had Local Radar and added Northeast Radar and have no issues.

When I go to add another Radar Link I end up with this:  XML error: not well-formed (invalid token) at line 40

Excerpt;  Current: flyout-menu.xml

<menu>
   <item caption="Home" link="index.php" title="Home Page"/>
   <item wxonly="VWS" caption="Mesonet" title="Local Weather Exchange Stations" link="wxmesonet.php"/>
   <item caption="Radar">
       <item caption="Local Radar" link="wxradar.php" title="Radar"/>
             <item caption="Northeast Radar" link="http://radar.weather.gov/ridge/Conus/northeast_loop.php" title="NE Radar"/>             
<!--
      <item caption="GRLevel3 Radar" link="wxgr3radar.php" title="NEXRAD Radar using GRLevel3" />


Adding Mount Holly like so:

<menu>
   <item caption="Home" link="index.php" title="Home Page"/>
   <item wxonly="VWS" caption="Mesonet" title="Local Weather Exchange Stations" link="wxmesonet.php"/>
   <item caption="Radar">
       <item caption="Local Radar" link="wxradar.php" title="Radar"/>
             <item caption="Mount Holly" link="http://radar.weather.gov/ridge/radar.php?rid=dix&product=N0R&overlay=11101111&loop=yes" title="MH"/>
             <item caption="Northeast Radar" link="http://radar.weather.gov/ridge/Conus/northeast_loop.php" title="NE Radar"/>             
<!--
      <item caption="GRLevel3 Radar" link="wxgr3radar.php" title="NEXRAD Radar using GRLevel3" />
-->
   </item>

That produces the: XML error: not well-formed (invalid token) at line 40

Looking up that error message it seems to mean that I am missing something like a < or / but perhaps this can't be added at all.

I know the fly-out menu warns about going more that 4 sub-directories but that is not 4 and others have more that 4 -- but of-course I'm not even sure what that means (?)

I gladly accept any direction or help,

yamiacaveman

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Fly-out menu Question
« Reply #1 on: July 22, 2015, 09:45:59 AM »
Could you please paste your whole XML menu which does not work?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Fly-out menu Question
« Reply #2 on: July 22, 2015, 10:17:09 AM »
This entry is almost properly formed .. it has a proper /> closing and all the attributes.

The only issue is how the '&' characters must be treated.

XML doesn't like 'naked' ampersands but insists they be represented as '&amp;' (the HTML entitity).  The XML parser will automatically change all '&amp;' to '&' and go on it's merry way.  But that creates a 'naked' ampersand in the resulting HTML.

So, the trick is to replace any '&' with '&amp;amp;' strings in the URL, and the final HTML will have &amp; in it (which will make the HTML validator happy too.

Change your
Code: [Select]
<item caption="Mount Holly" link="http://radar.weather.gov/ridge/radar.php?rid=dix&product=N0R&overlay=11101111&loop=yes" title="MH"/> to
Code: [Select]
<item caption="Mount Holly" link="http://radar.weather.gov/ridge/radar.php?rid=dix&amp;amp;product=N0R&amp;amp;overlay=11101111&amp;amp;loop=yes" title="MH"/> and it should work fine.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline yamiacaveman

  • Forecaster
  • *****
  • Posts: 439
    • Penn Lake Weather
Re: Fly-out menu Question
« Reply #3 on: July 22, 2015, 12:34:56 PM »
Thanks Ken,

Works Perfect!!!

yamiacaveman

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Fly-out menu Question
« Reply #4 on: July 22, 2015, 12:49:04 PM »
You're welcome :)

Just remember that this replace '&' with '&amp;amp;' little trick applies to ALL the quoted strings in the flyout-menu.xml (title=, link= and caption= attributes).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP