Syntax: ‘%’ + variable name + ‘%’
Example 1. Connecting securely to a Spatial Database
You want to map some senstitive data held in a PostGIS database. The username and password to be used for the database connection are held in 2 cookies previously set by a seperate authentication mechanism, “uid” and “passwd”.
CONNECTION "user=%uid% password=%passwd% dbname=postgis"
Example 2. Handling temporary files
You have a user based discovery application that generates shapefiles and stores them in a user’s home directory on the server. The “username” comes from a cookie, the “filename” comes from a request parameter.
DATA "/home/%username%/tempshp/%filename%"
This feature is only available in the CGI version of MapServer through a mapfile pre-processor. If you are using MapScript, you will have to code the substitution logic into your application yourself (By writing your own pre-processor).