cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Topic Markup Language and applications: Answered

how to use OpenLayers.js in fowsiki?

I'm trying to include an OpenLayers map (as per http://docs.openlayers.org/library/introduction.html#putting-it-all-together) on fowsiki.

I have a topic with:


%ADDTOHEAD{text="<script  type=\"text/javascript\" src=\"http://openlayers.org/api/OpenLayers.js\"></script>"}%

<sticky>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">
        var map = new OpenLayers.Map('map');
        var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",   "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
        map.addLayer(wms);
        map.zoomToMaxExtent();
      </script></sticky>

but nothing is rendered. Any suggestions welcome!

dave r.
The first thing to do is to put <literal>...</literal> around your script. That will prevent Foswiki trying to render it. The other thing is to debug using firebug in Firefox, and watch to make sure it does something.

-- CrawfordCurrie - 21 Jun 2010
Thanks! After adding the literal tags and a bit of playing, I found that it was just a matter of specifying the size explicitly. Let's see if it works here...

-- DavidRayner - 23 Jun 2010

QuestionForm edit

Subject Topic Markup Language and applications
Extension
Version Foswiki 1.0.9
Status Answered
Topic revision: r3 - 23 Jun 2010, DavidRayner - This page was cached on 04 May 2018 - 10:04.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License