[mapguide-users] What is %24CurrentSelection???
achectl at gmail.com
Wed Mar 25 03:43:05 EDT 2009
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"
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.
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.
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of achectl
Sent: Tuesday, March 17, 2009 10:52 PM
To: mapguide-users at lists.osgeo.org
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?
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,
> $mapName = "";
> $sessionId = "";
> // Initialize the web tier API
> // Read the map name and session ID
> // Create a site connection
> $user = new MgUserInformation($sessionId);
> $siteConnection = new MgSiteConnection();
> // 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")
mapguide-users mailing list
mapguide-users at lists.osgeo.org
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.
More information about the mapguide-users