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

kreshna_iceheart at yahoo.com kreshna_iceheart at yahoo.com
Tue Jun 3 11:15:48 EDT 2008


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





      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080603/234bba9b/attachment.html


More information about the mapserver-users mailing list