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

Wim Blanken w.blanken at geon.nl
Tue Jun 3 12:13:26 EDT 2008


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



 

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


More information about the mapserver-users mailing list