php mapscript persistance across requests
Paul Spencer
pspencer at DMSOLUTIONS.CA
Sun Dec 5 15:11:20 PST 2004
John,
here's three different approaches you might consider using
1. hidden HTML inputs
2. session variables
3. saving the entire map file
You will probably need to use a combination of these ... each one is
only an example, you'll need to do some work to figure out how to use it
in your setup ...
Cheers
Paul
--
1. Hidden HTML variables
<?php
if (isset($_REQUEST['extents']) && $_REQUEST['extents'] != '')
{
$aExtents = explode( ',', $_REQUEST['extents'] );
if (count($aExtents) == 4)
{
$oMap->extents->setextent( $aExtents[0], $aExtents[1],
$aExtents[2], $aExtents[3] );
}
}
//some processing
?>
<input type="hidden" name="extents" value="<?php echo implode( ",",
$oMap->extents)?>">
use the same approach (html hidden variables) for all other information
2. Session variables
<?php
if (isset($_SESSION['extents']) && $_SESSION['extents'] != '')
{
$oMap->extents->setextent( $_SESSION['extents'][0],
$_SESSION['extents'][1],
$_SESSION['extents'][2],
$_SESSION['extents'][3] );
}
//some processing
$_SESSION['extents'] = $oMap->extents;
and use the same approach for all other information
3. Save map file ...
<?php
if (isset( $_SESSION['previousState'] ))
{
$oMap = ms_newMapObj( $_SESSION['previousState'],
$_SESSION['originalLocation'] );
}
//some processing
$oMap->save( $tempFile );
$_SESSION['previousState'] = $tempFile;
?>
Jon Saints wrote:
> I Am new to php mapscript. Is there any standard way
> of storing map extent and layer information across
> http requests in phpmapscript?
>
> I realize that storing the map object in the session
> is not possible. What are my other options?
>
> Thanks
>
--
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+
More information about the MapServer-users
mailing list