PHP/MapScript: getLayerByName()

DjwStone D.Stone at ED.AC.UK
Fri May 5 06:03:25 EDT 2006


I'm taking first faltering steps with PHP/MapScript so forgive if following
question is dumb.

A la classic MapServer tutorial example, I'm building an interactive map
form which allows pan/zoom/layer selection. It's the last of these that's
giving me difficulty.

The HTML defines a select list of layers:

   <SELECT MULTIPLE NAME="layers[]" SIZE=3>
   <!-- the list of layers to choose from -->
     <OPTION VALUE="parish_labels"> Parish names</OPTION>
etc.,....

When the form is submitted, the PHP should tell MapServer which elements in
the list were selected. My code is:

function retrieve_select(){
   for ($r=0; $r <= count($_POST['layers'])-1; $r++){
       // echo $_POST['layers'][$r]."<BR>";
       $my_layer=getLayerByName($_POST['layers'][$r]);
       $i = $my_layer->set($my_layer->status, MS_ON);
   }
}

However, PHP reports 'Call to undefined function getLayerByName()'. Since I
found the function in the PHP/MapScript Class Reference document, I'm
wondering if this is a deliberately misleading error message?!

Any help gratefully acknowledged...

Dave


--
View this message in context: http://www.nabble.com/PHP-MapScript%3A-getLayerByName%28%29-t1562941.html#a4244464
Sent from the Mapserver - User forum at Nabble.com.



More information about the mapserver-users mailing list