[postgis-users] Session and dynamic maps
Ibrahim Khachab
ibrahim at oriented.it
Mon Nov 5 09:00:59 PST 2007
Hi,
I'm using pmapper with a sort of dynamic map viewing (I wrote a php code
to create config and map files on the fly). The url the contained a "me"
parameter to make an initial zoom.
I noticed that after the firs map was displayed the other ones had an
initial zoom as the first one and thus not diaplaying the right area of
the map.
I mad a lot of debug and I found two ways to "fix" this problem.
tThe first and simple one is, when you use different config files, to
make the first if block in the config/__startup_config.php file to look like
if (isset($_REQUEST['config'])) {
// Check for invalid GET variables
if (preg_match("/\/|\./", $_REQUEST['config'])) exit();
$config = trim($_REQUEST['config']);
if ($config != $_SESSION['config']){
unset($_SESSION["GEOEXT"]);
}
}
The added lines are
if ($config != $_SESSION['config']){
unset($_SESSION["GEOEXT"]);
}
The other one would work on any configuration and involves the
pmap_setGeoExt() function in the incphp/map.php file.
The idea is to switch the first two if blocks making
if (isset($_SESSION["GEOEXT"])) {
....
GEOEXT code
...
}elseif (isset($_SESSION['zoom_extparams'])) {
....
zoom_extparams code
...
looks like this
if (isset($_SESSION['zoom_extparams'])) {
....
zoom_extparams code
...
}elseif (isset($_SESSION["GEOEXT"])) {
....
GEOEXT code
...
}
So the $_SESSION['zoom_extparams'] will have the precedence on the
$_SESSION["GEOEXT"] one.
I hope this may help who may have the same problem that I had.
Ibrahim Khachab
More information about the postgis-users
mailing list