[OpenLayers-Users] permalink on dynamic pages?

mc.prins mc.prins at gmail.com
Wed Sep 3 08:45:25 EDT 2008


On Wednesday 03 September 2008 13:38:34 you wrote:
> On Wed, Sep 03, 2008 at 10:33:00AM +0200, mc.prins wrote:
> > Hi all,
> > I'm working on a Dokuwiki[1] plugin that enables use of OL on the
> > Dokuwiki pages[2]. it seems however that the permalink isn't updated when
> > there's a questionmark in the URL... does anyone share that experience.
> > I've ran into this at work but at the time just couldn't be bothered and
> > left the link out.
>
> This works fine.
>
>   http://openlayers.org/dev/examples/controls.html?a=b

yes I see that it does

> I can't tell you why it doesn't work in your page; I spent several
> minutes looking and couldn't find your code, and your map object isn't a
> global variable.

that's correct; I have (a) user generated map id (ids) which I pass to a 
createMap method which then sets everything up.
Dokuwiki uses a compress-and-cache version of all the plugin scripts which 
gets loaded for each page, so it would be hard to find. this plus the fact 
that there might be more than one map on a page (eg. 
http://535359d3.cable.casema.nl/dokuwiki/doku.php?id=start has two atm.) 
makes it very hard to have the map/maps as a global var (yes I could stick 
them all in a global var which is an array or object.. but this turned out 
rather challenging on the backend). 
also I want to avoid loading the OL libs/scripts if there's no map on a page

I have the script w/ the createMap attached now.

a user enters something along the lines of:

<olmap id="olmappie" width="800px" height="600px" lat="50.62361" lon="5.5792" 
zoom="5" statusbar="1" toolbar="1" controls="1" poihoverstyle="0">

49.9780098,5.1839387,30,.5,marker.png,Faux Mayaux; Maissin
50.0117497,5.1287857,180,.9, ,Pont de Barbouillons; Daverdisse
50.62344,5.57904, , , ,Parc de Boverie; Liege

</olmap>

which wil render into a map w/ id "olmappie" on the page with these 3 POI, 
centered on the lat/lon and zoom etc.. like below


> My naive guess is that you don't have a Permalink 
> Control on your map.

it's in the "statusbar" of the map widget (map link) next to the scale and 
looks like

<div id='$mapid-statusbar-link' class='olStatusBar olStatusBarPermalink'>
	<a href='' id='$mapid-statusbar-link'>map link</a>
</div>

$mapid gets replaced serverside by the id attribute of the olmap tag shown 
above. the create map function does:

	m.addControl(new OpenLayers.Control.Permalink( {
	    'div' :OpenLayers.Util.getElement(mapOpts.id + '-statusbar-link')
	}));
where mapOpts.id === $mapid

I do the same for the scale and coords and these work fine..

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: script.js
Type: application/x-javascript
Size: 9227 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080903/f13e8369/script.js


More information about the Users mailing list