Query template file question

Stephen Lime steve.lime at dnr.state.mn.us
Sat Oct 30 09:22:55 PDT 1999


Ok. The comments in the .ini file say that the value for TEMPLATE_VALUE should be a regular
expression. The examples you show are not regular
expresions, hence there problems. O'Reilly has an
excellent regex reference book in case anyone in
is interested. You have the right idea (or'ing), but the syntax is all wrong.  

Corrent me if I'm wrong , but CGI processes return
content directly to the browser. I don't believe
you can have PHP process a page generated by the
MapServer. I know this used to be the case but
haven't researched it in a while.

In general, I've chained things together using URL
forwarding. MapServer forwards its stuff to another URL, bypassing the browser. That's what Ken was suggesting. Other than the double quotes
issue it sounds as if that worked for you.

Another way to do it is to use JavaScript. You can
create a page that is essentially empty except for
some javascript. That code can be initialized using standard mapserver substitutions and then can either build the page itself or replace the page with some URL. Example 5 in the short tutorial I mention on the list in late Sept does exactly this. Can be very powerful. 

If anyone knows of a way to filter a page from CGI
before it is sent to the client, speak up. I'd love to be able to even just use simple SSI in a
template file.

Of course, with mapscript much of this becomes a
thing of the past as you can do all of your mapping and PHP-like stuff (eg. database) in one
script.

Steve

 

<<< "Jim T. Bowen (GAIA Consultants Inc.)" <bowenj at gaiaenv.com> 10/30 10:54a >>>
Hello all,

I tried both Brent and Ken's suggestions with limited success...perhaps
I am missing something simple.  Here are my findings:


**********************************************************************
*** Brent's suggestion (change the mapserv.ini setting) **************
**********************************************************************
As a simple test, I created a file with no php3 tags, simply straight
html [with a couple of MapServer tags (e.g., [shpminx])] and gave the
file an extension of '.php3'.  I changed the mapserv.ini file to reflect
the '.php3' extension for templates.  The query worked and MapServer
populated the template with information; however, if I try to redraw the
map, I receive a 'malformed template' error from MapServer.  Any
thoughts?  

Also, does anyone know if it is possible to include more that one
regular expression per parameter in mapserv.ini? (e.g.,
'TEMPLATE_EXTENSION=\.html$ or TEMPLATE_EXTENSION=\.php3$')  I tried
this, but received an error 'received 3 parameters, expecting 2'.  FYI,
I also tried 'TEMPLATE_EXTENSION=\.html$ or \.php3$'


**********************************************************************
*** Ken's suggestion (pass args directly to PHP3 via the URL str) ****
**********************************************************************
I attempted to pass the arguments to my php3 page as suggested by Ken.  

I noticed I was not double-quoting my path and filename parameter in my
map file.  The map file example
(http://mapserver.gis.umn.edu/demo_map.txt) does not indicate
double-quotes are required.  It appears the double-quotes are required
only if special characters (e.g., ?, %, etc.) are included in the
parameter (my guess).  Changing to double-quoted string permitted the
passing of arguments from MapServer to PHP3 without error.  The result
was no 'malformed template' error when drawing the map, but this error
did arise when querying.


**************
*** Other ****
**************
I also tried hybrids of Brent's and Ken's suggestions.  Does anyone have
any other ideas surrounding this issue?  

If there are no conclusions in the next couple days, I suggest killing
this thread.  The 'http-equiv refresh' workaround is not too cumbersome
and it does produce results.  Thanks in advance.


Cheers,
Jim
 ___________________________________    GGG G   AAA      III    AAA     
|  Jim T. Bowen, M.Sc., President   |  G   GG     A       I       A     
|                                   | G     G    A A      I      A A    
|Suite 306,  822-11th Ave. S.W.     | G     G    A A      I      A A    
|Calgary, Alberta, Canada  T2R 0E5  | G         A   A     I     A   A   
|Ph: 403-571-7213  Fax: 403-571-7211| G   GGGG  A   A     I     A   A   
|_______bowenj at gaiaenv.com__________| G     G   AAAAA     I     AAAAA   
           ICQ: 15567315              G     G  A     A    I    A     A  
      http://www.gaiaenv.com           G    G  A     A    I    A     A
                                        GGGG  AAA   AAA  III  AAA   AAA




More information about the MapServer-users mailing list