Changes between Version 1 and Version 2 of CodeSamples/PHP/AddLayerToInitialMap
- Timestamp:
- 09/05/08 02:11:12 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodeSamples/PHP/AddLayerToInitialMap
v1 v2 5 5 == Dynamically adding a layer to the initial map == 6 6 The following script shows how to create a temporary !MapDefinition and insert a layer that is visible when the map loads. 7 It can also be modified to toggle a layer s initial visibility.7 It can also be modified to toggle a layer's initial visibility. 8 8 9 9 == Things to note == … … 36 36 // Create the MapLayer XML nodeset in the first position 37 37 $targetNode = $mdDomDoc->getElementsByTagName("MapLayer")->item(0); 38 $newNode = $targetNode->parentNode->insertBefore(new DOMElement("MapLayer"), 39 $targetNode); 38 $newNode = $targetNode->parentNode->insertBefore(new DOMElement("MapLayer"), $targetNode); 40 39 $newNode->appendChild($mdDomDoc->createElement("Name", $layerName)); 41 $newNode->appendChild($mdDomDoc->createElement("ResourceId", 42 $rlLayerResourceId)); 40 $newNode->appendChild($mdDomDoc->createElement("ResourceId", $rlLayerResourceId)); 43 41 $newNode->appendChild($mdDomDoc->createElement("Selectable", "false")); 44 42 $newNode->appendChild($mdDomDoc->createElement("ShowInLegend", "false"));