Hi jsanchez, <br><br>There are a few different ways you can accomplish this. I would recommend that you create a separate php script and call it on the fusion.onInitialize <br><br>Here's some sample code. It may be a little rough and need a little TLC as I just whipped it together for you.<br>
<br><br>window.onload = function() {<br> Fusion.initialize();<br> Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED, onInitialize);<br>}<br><br>function onInitialize(){<br> // create a queryString object<br>
var oQS = new queryString();<br><br> // get the QS "layers"<br> var gLayers = oQS.get("layers");<br><br> // get the mapwidget<br> var mapWidget = Fusion.getMapById('mapArea');<br>
var maps = mapWidget.getAllMaps();<br> var map = maps[0];<br><br> // set the parameters for sessionid and mapname and layers<br> var session = 'session='+map.getSessionID();<br> var mapName = '&mapname='+ map._sMapname;<br>
var layers = '&layers='+gLayers;<br> var params = session+mapName<br><br> // bind ajax call to the function reloadMap<br> var opts = {parameters: params, onComplete: reloadMap.bind(null)};<br><br>
var s = "../myApp/showLayers.php";<br><br> // trigger the ajax call<br> Fusion.ajaxRequest(s, opts);<br>}<br><br>function reloadMap(){<br> var map = Fusion.getMapById('mapArea');<br> var maps = map.getAllMaps();<br>
maps[0].reloadMap();<br>}<br><br>function queryString(qs){<br> d.log("queryString");<br> this.params = {};<br> this.get=queryString_get;<br><br> if (qs == null)<br> qs=location.search.substring(1,location.search.length);<br>
<br> if (qs.length == 0) return;<br><br> qs = qs.replace(/\+/g, ' ');<br> var args = qs.split('&');<br><br>// split out each name=value pair<br> for (var i=0;i<args.length;i++) {<br> var value;<br>
var pair = args[i].split('=');<br> var name = unescape(pair[0]);<br><br> if (pair.length == 2)<br> value = unescape(pair[1]);<br> else<br> value = name;<br><br> this.params[name] = value;<br>
}<br>}<br><br>/*<br>function queryString_get - return the key values<br>*/<br>function queryString_get(key, default_) {<br> // This silly looking line changes UNDEFINED to NULL<br> if (default_ == null) default_ = null;<br>
<br> var value=this.params[key];<br> if (value==null) value=default_;<br><br> return value;<br>}<br><br><br><div class="gmail_quote">On Wed, Feb 18, 2009 at 5:18 AM, jsanchez <span dir="ltr"><<a href="mailto:ebarrera@inm.es">ebarrera@inm.es</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Hello all,<br>
<br>
I'm just testing 'Fusion' and I wonder if it would be possible to deal with<br>
dynamic layers.<br>
<br>
I would like the user could choose the data shown in a fixed given layer. To<br>
do so, I don't define the layer it on my MapServer/MAPFILE but instead I<br>
create it during Fusion load proccess using Mapscript in LoadMap.php which<br>
works fine.<br>
<br>
Now I'd like to know how to pass a parameter from URL application to<br>
LoadMap.php containing the 'data' layer parameter which points to desired<br>
raster file.<br>
<br>
<br>
Thanks<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://n2.nabble.com/How-to-pass-a-parameter-from-URL-tp2346032p2346032.html" target="_blank">http://n2.nabble.com/How-to-pass-a-parameter-from-URL-tp2346032p2346032.html</a><br>
Sent from the Fusion Users mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
fusion-users mailing list<br>
<a href="mailto:fusion-users@lists.osgeo.org">fusion-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/fusion-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/fusion-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> Paul Deschamps<br> Applications Specialist<br> DM Solutions Group Inc.<br><br> Office: (613) 565-5056 x28<br> <a href="mailto:pdeschamps@dmsolutions.ca">pdeschamps@dmsolutions.ca</a><br>
<a href="http://www.dmsolutions.ca">http://www.dmsolutions.ca</a><br> <a href="http://research.dmsolutions.ca">http://research.dmsolutions.ca</a><br> <br><br>