[mapserver-commits] r9280 - trunk/docs/en/cgi

svn at osgeo.org svn at osgeo.org
Fri Aug 28 07:53:53 EDT 2009


Author: tbonfort
Date: 2009-08-28 07:53:52 -0400 (Fri, 28 Aug 2009)
New Revision: 9280

Modified:
   trunk/docs/en/cgi/runsub.txt
Log:
add paragraph on default values for runtime substitution


Modified: trunk/docs/en/cgi/runsub.txt
===================================================================
--- trunk/docs/en/cgi/runsub.txt	2009-08-28 08:56:27 UTC (rev 9279)
+++ trunk/docs/en/cgi/runsub.txt	2009-08-28 11:53:52 UTC (rev 9280)
@@ -75,7 +75,7 @@
 You can use runtime substitutions to change values within a FILTER as you go.
 For example your FILTER could be written like so::
 
-    FILTER ("multimedia='[multimedia]' and seats >= [nseats] and Sound= '[sound]')
+    FILTER ("multimedia='%multimedia%' and seats >= %nseats% and Sound= '%sound%')
 
 Then (assuming you're using the CGI interface) you could pass in variables
 named multimedia, nseats and sound with values defined by the user in an HTML
@@ -99,3 +99,30 @@
 limit the value of multimedia and sound to yes or no. The third limits the
 value for nseats to a 2 digit integer.
 
+Default values if not provided in the URL
+--------------------------------------------------------------------------------
+
+The runtime substitution mechanism will usually create syntactically incorrect, 
+and almost always semantically incorrect mapfiles if the substitution parameter
+was not provided in the calling URL.
+
+Since version 5.6, you can provide a default value for any substitution parameter, 
+that will be applied if the parameter was not found in the url. You do this by 
+providing special entries inside the layer metadata :
+
+.. code-block:: mapfile
+
+    METADATA
+        'default_sound' 'yes'
+        'default_nseats' '5'
+        'default_multimedia' 'yes'
+    END
+
+In this example, the mapfile will be created as if the url contained 
+"&sound=yes&nseats=5&multimedia=yes"
+
+This behavior is also accessible in the shp2img utility, allowing you to test 
+runtime substitution mapfiles without using a webserver.
+
+
+



More information about the mapserver-commits mailing list