Hi Chris, I tried to add the syntax to the date.php by using "include "mapguide.php";", the MgInitializeWebTier path was updated. And I would like to mention that the date.php isn't running into mapguide web server. It is running on xampp LAMP software of Windows.
And I tried to run the php program date.php, the error was prompted. Fatal error: Call to undefined function mginitializewebtier() in C:\xampp\htdocs\mrbs\web\mapguide.php on line 9 Also I have added the path as below into the php.ini file. ; Directory in which the loadable extensions (modules) reside. extension_dir = "C:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\php\ext" extension=php_MapGuideApi.dll The result is same. I have question, why the parameter (e.g. SESSION, LOCALE & MAPNAME) of invokeURL.js file do not added to the date.php, but the invoke url have right parameters! It is not %24CurrentSelection. Thanks. You should be able to include this code at the beginning of your own php file. I believe it is called date.php. This file presumably does something useful with the information about the current selection. You should be able to retrieve the information you need from the MgSelection object using some simple php calls instead of calling echo $selection->ToXml(). >From your original screenshots it looks like you have already managed to >create an InvokeURL command in MapGuide Studio, but if you have specific >questions about the process, let me know. Chris. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of achectl Sent: Tuesday, March 17, 2009 10:52 PM To: [email protected] Subject: RE: [mapguide-users] What is %24CurrentSelection??? Thanks a lot Chris Which file I need to modify and copy & place the below PHP code to that file for testing? I will try to modify the code. Note: I will change the path for webconfig.ini. :-( I need to complete the invokeURL problem asap. What is the proper way to do InvokeURL of MapGuide Studio? Thanks Achectl Chris Claydon wrote: > > In a basic web layout, I'm pretty sure $CurrentSelection returns you the > current selection in XML format. This corresponds to the string you get if > you call ToXml() on an MgSelection object using the web tier API. > > It appears that the flexible web layout code does not treat > $CurrentSelection as a special case, and simply returns the URL-encoded > version of variable name itself. > > The solution is to get hold of the MgSelection object for the current map > selection within the invoked PHP code. The following PHP code will dump > out the selection XML. You should be able to extend it pretty easily to > extract exactly what you need from the selection... > > (Note that you may need to adjust the path to the webconfig.ini file in > the call to MgInitializeWebTier) > > Hope this helps, > > Chris. > > <?php > > $mapName = ""; > $sessionId = ""; > > try > { > // Initialize the web tier API > MgInitializeWebTier("C:/Program > Files/Autodesk/MapGuideEnterprise2009/WebServerExtensions/www/webconfig.ini"); > > // Read the map name and session ID > GetRequestParameters(); > > // Create a site connection > $user = new MgUserInformation($sessionId); > $siteConnection = new MgSiteConnection(); > $siteConnection->Open($user); > > // Create a resource service instance > $resourceService = $siteConnection->CreateService(0); > > // Retrieve the selection > $selection = new MgSelection(); > $selection->Open($resourceService, $mapName); > > // Output the selection > echo $selection->ToXml(); > } > catch(MgException $e) > { > // Output error details > echo "<Message>" . $e->GetMessage() . "</Message>"; > echo "<Details>" . $e->GetDetails() . "</Details>"; > } > > > function GetParameters($params) > { > global $mapName; > global $sessionId; > > $mapName = $params['MAPNAME']; > $sessionId = $params['SESSION']; > } > > function GetRequestParameters() > { > if($_SERVER['REQUEST_METHOD'] == "POST") > GetParameters($_POST); > else > GetParameters($_GET); > } > ?> > > > _______________________________________________ mapguide-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapguide-users -- View this message in context: http://n2.nabble.com/What-is--24CurrentSelection----tp2490302p2531075.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapguide-users
