[mapserver-users] SUM: Template URL

Richard Greenwood Rich at GreenwoodMap.com
Sat Oct 6 12:01:09 EDT 2001


I flailed around with template URLs this week and finally got it straight 
in my mind (and working in my application), so I thought I'd document it 
for the list archive. If I was smart enough to setup DocBook, I'd 
contribute this to the documentation project, but that will have to wait 
for another day.

Thanks to Ed McNierney and Stephen Lime for helping me out so much.

A TEMPLATE can be either a File or a URL. MapServer examines a template 
definition, decides  whether you have specified a File or a URL, and 
responds accordingly. For example;
      "Display_Results.html"
looks like a file and so will be processed as a file, but
     "http://www.some_domain.com/Index.html"
looks like a URL and so will be processed as a URL, which is quite a bit 
different than how a File is processed.

If MapServer decides that it has a file template, it goes through the file 
and replaces stuff within [] with appropriate data. If the template is a 
URL, however, MapServer redirects to that URL. The URL might be on the same 
server, or another server. Although MapServer can not process the file 
pointed to by a URL, it does process the URL string itself. For example:
     http://www.tetonwyo.org/clerk/query/default.asp?pidn=[PIDN]
MapServer will replace [PIDN] with an appropriate value before redirecting 
to the new location. Note also that you can go to an Active Server Page, or 
other not-purely HTML type location. (To me, this is really sweet, because 
it allows you to easily mix CGI MapServer with other web technologies.)

Okay, so you read this far and I still haven't told you anything that you 
didn't already know, but here's what had me flailing. A template can only 
reference a URL in a SINGLE query mode. So if you are in a MULTIPLE query 
mode, e.g. nquery, MapServer only attempts to processes the template as a 
file. Not a good thing if you specified a URL, but still entirely logical. 
A URL is intrinsically a single thing, and you can't simultaneously 
redirect a browser to multiple locations. In other words, MapServer assumes 
that if your query could potentially return more than one result, that you 
would have specified a File for the template, not a URL.

So that's the most interesting thing I learned this week.

Happy mapping,
Rich


Richard W. Greenwood, PLS
Greenwood Mapping, Inc.
Rich at GreenwoodMap.com
(307) 733-0203
http://www.GreenwoodMap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20011006/74f9b20f/attachment.html


More information about the mapserver-users mailing list