Hi,

The mapfile is reloaded in the $map vairiable, a MapObj object, each 
timeglobals.php is called.

So if core pmapper code need globals.php, your layer is not added.

You should use "phpMapObjModifierFiles  " (in 
rou_pugin_directory/config.inc). The files you will add here will be 
called at the end of globals.php, so your layer will be added to the 
global $map object.

- in config.inc :
<?php
$phpMapObjModifierFiles  = 
array('auto_included_file_that_will_modify_mapObj.php');
?>

- in auto_included_file_that_will_modify_mapObj.php :
<?php
if (isset($_SESSION['addMyLayerOrNot']) && $_SESSION['addMyLayerOrNot']) {
     // your code to add the layer
     $map->...
}
?>

- in the php file called from your js I suppose :
<?php
// your code, and when you want to add the layer at next refresh :
$_SESSION['addMyLayerOrNot'] = true;
?>

If you always want to add the layer, without js etc... forget the 
session variable...

Bye

Thomas


Le 08/01/2013 08:34, allspatial a écrit :
> Dear pmapper Team,
>
> I wrote a plugin for pmapper 4.02. In the PHP code of my plugin I added a
> layer to the Map using the $map variable from globals.php:
>
> require_once("../../incphp/globals.php");
> ...
> ...
> $roadLayer = ms_newLayerObj($map);
> ...
> ...
>
> However, when I reload the map later on (using PM.Map.reloadMap() in the
> JavaScript code of my plugin) the new layer is not reflected/shown in the
> map. A $map->numlayers will result in 8 in my plugin but 7 if executed in
> incphp/map/map.php. Would you have any idea why my change (the layer I
> added) is not reflected in the global map variable?
>
> Many thanks,
>
> Michael


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to