Niccolo I think there is a bug in the code as left over from some earlier version. You could try changing the line in dynlayer.php->createDynLayers() from foreach ($dObj->layerlist as $dl) { to foreach ($dObj as $dl) {
But it might still not work. I got strange and practically not debuggable segmentation vialotaions from the PHP CGI, so I stopped there quite some time ago. The JSON encoded approach was an attempt to have a layer representation in text form that can be easily added to the map. The new function of creating a layer object based on map file syntax strings (available since MS 5.4) made this somehow obsolete. So I guess I will not try to resurrect it in its current implementation. Maybe once add the same functionality using map file syntax (or XML parsed to map file syntax via the XSLT available on the development part of Mapserver...). Armin On 25/05/2010 18:53, Niccolo Rigacci wrote: > I'm writing a p.mapper application where I need to dynamically > add some layers on user input. > > I'm looking at the dynlayersample plugin, but I cannot understand > how it is supposed to work. I initialize dynlayers with the given > example text file: > > jsonFile = "dynlayer_def.txt"; > $dynLayers = preg_replace(...., file_get_contents($jsonFile)); > $dyn = new DynLayer($map, $dynLayers); > > > But the DynLayer class seems to expect a different json object, > because it fails in several places: > > foreach ($this->json as $dObj) { > require_once($dObj->require); > ... // $dObj->require is empty > > foreach ($dObj->layerlist as $dl) { > $this->createDynLayer($dl); > ... // $dObj->layerlist is not valid for foreach. > > > Is dynlayer an usable feature? Some hints? > ------------------------------------------------------------------------------ _______________________________________________ pmapper-users mailing list pmapper-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pmapper-users