[mapserver-users] Dinamically changing HTML Template using CGIparameter? (instead of hardcoded)

Wim Blanken w.blanken at geon.nl
Thu Jun 5 23:23:04 PDT 2008


Hi Kresh,

 

In Mapserver 4.x the method is slightly different. You can use :

 

map_web_template=othertemplate.html

 

Regards,

 

Wim Blanken

-----Original message-----
From: kreshna_iceheart at yahoo.com
Sent: Fri 06/06/08 05:45:14
To: Wim Blanken <w.blanken at geon.nl>; 
Subject: RE: [mapserver-users] Dinamically changing HTML Template using CGIparameter? (instead of hardcoded)

Hi, thank you, Wim. I'm using ms4w 4.4.0 by the way, but I'll definitely try the methods you've mentioned.

Many thanks,
-Kresh



--- On Tue, 6/3/08, Wim Blanken <w.blanken at geon.nl> wrote:
From: Wim Blanken <w.blanken at geon.nl>
Subject: RE: [mapserver-users] Dinamically changing HTML Template using CGIparameter? (instead of hardcoded)
To: mapserver-users at lists.osgeo.org
Date: Tuesday, June 3, 2008, 12:13 PM


Hello Kresh,

 

Sorry, I did not read you question carefull enough .the answer is about changing the template of a single layer and not the main template.

 

Changing the main map template goes with cgi (mapserver 5) i believe as follows: 

 

..&map_web=TEMPLATE+othertemplate.html

 

Sorry for the inconvenience .

 

Wim Blanken

The Netherlands


Van:mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] Namens kreshna_iceheart at yahoo.com
Verzonden:Tuesday, June 03, 2008 5:16 PM
Aan:mapserver-users at lists.osgeo.org
Onderwerp:[mapserver-users] Dinamically changing HTML Template using CGIparameter? (instead of hardcoded)


 

I have one mapfile, let say, PACITAN.MAP, with two template files: PACITAN-TMPL.HTML and PACITAN-PRINT-TMPL.HTML. The former is the "primary" template for the normal web map display, while the latter has "cleaner look" for printing purpose (print page).

The print page (PACITAN-PRINT-TMPL.HTML) is called from the "primary" template page using JavaScript window.open() function. 

When calling the print page, I can easily pass (and manipulate, if necessary) map-related information using CGI parameters. For example, layer information (ie which layers are selected) is passed with layers=[layers] CGI parameter, while extent information is passed with mapext=[minx], [miny], [maxx], [maxy] parameter.

The problem is: since the name of HTML template is hard-coded in the *.map file, I have to create another map file named PACITAN-PRINT.MAP, which is basically an exact copy of PACITAN.MAP, but using PACITAN-PRINT-TMPL.HTML as template  (hard-coded in the mapfile, of course).

If I can dynamically change the name of the HTML template using CGI parameters, I don't have to use two versions of mapfile; I can just use one mapfile with two HTML templates and be done with it.

The problem is; is it possible to pass the name of the HTML template using CGI parameters? And if it is, then how? I have browsed MapServer documentations and this is all I found:

TEMPLATE has been removed, since the map_web_template syntax can be used to alter a template file. Simplifies security maintenance by only having to deal with this option in a single place. Note that the TEMPLATEPATTERN of the mapfile has to be used to enable this feature.

However, save the vague reference above, I just could not find any other explanation about the map_web_template syntax above. Is it a CGI parameter? Can I just use the map_web_template parameter in my url, to specify which template to use?

Many thanks,
-Kresh



 



_______________________________________________ mapserver-users mailing list mapserver-users at lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080606/30b9e8c5/attachment.htm>


More information about the MapServer-users mailing list