same effect as CGI mode=itemquerymap but with PHP/mapscript

Rodrigo Martín LÓPEZ GREGORIO rodrigomlg at GMAIL.COM
Tue Aug 7 09:17:47 EDT 2007


Finaly I figured out how to get it working; in my php mapscript file I added
the next code:

if ($_GET['mode'] == 'itemquerymap') {
 $qstring = explode("=",$_GET['qstring']);
 $map->getLayerByName($_GET['qlayer'])->queryByAttributes($qstring[0],str_replace("\\","",$_GET['qstring']),MS_SINGLE);
  // I remove the \ characters of the qstring
}

And at the end of my file:

if ($_GET['mode'] == 'itemquerymap') {
   $image=$map->drawQuery();
} else {
   $image=$map->draw();
}

So if the mode is itemquerymap I draw the query; otherwise I make a normal
draw.

Rodrigo.

On 8/3/07, Rodrigo Martín LÓPEZ GREGORIO <rodrigomlg at gmail.com> wrote:
>
> Hi List.
>
> Normally I use mapserver as CGI, but now I need to move to PHP/mapscript.
> In my actual applet I use the CGI mode=itemquerymap to show the selected
> polygon on a layer with different color. So I pass the next values on the
> CGI call:
>
> mode=itemquerymap&qlayer=mylayer&qstring=someattribute='avalue'
>
> This works greats through CGI. Now I want to get the same effect using PHP
> Mapscript but I'm a little confused how to get it working. I know how to get
> the string parameters in php, even split the qstring parameter using explode
> but what I don't know is what must I do to get PHP Mapscript use the
> QUERYMAP format (defined in my base mapfile) to show the selected polygon.
>
> Can anyone give me a hint?
>
> Thanks.
>
> Rodrigo.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070807/d10eed03/attachment.html


More information about the mapserver-users mailing list