<div>I read a thread here earlier regarding the removal of extra fields from the results as well as searching for links in the field values. All is going well, but I seem to have an extra column being added at the start of the headers for the table and this is making all of the results be off by one field. Code follows. Any help would be GREATLY appreciated.
</div>
<div> </div>
<div> </div>
<div><font size="2">
<p>// read map file: header -> definition of table header</p>
<p>// the order of the columns are important, there will be shown in this order</p>
<p>// HEADER "AREA^|PERIMETER^|POPPLACE_^|POPPLACE_I^|UNIQUE_KEY^Code|NAME^Name|NAME_E^|NAME_F^|REG_CODE^|NTS50^|LAT^|LONG^|SGC_CODE^|CAPITAL^|POP_RANGE^|SHAPE_INDEX^|TILE_INDEX^|LAYER_INDEX"</p>
<p>// the seperator of a column '|'</p>
<p>// the seperator between column and displayname '^'</p>
<p>// if the displayname is missing the column is not be shown</p>
<p>$oLayer = $oMap->getLayerByName($aszLayers[$i]);</p>
<p>$szHeader = $oLayer->header;</p>
<p>$aszHeaderNames = array();</p>
<p>if (trim($szHeader) != '' && strpos($szHeader, "^") !== false)</p>
<p>{</p>
<p>$aszHeader = explode('|', $szHeader);</p>
<p>foreach ($aszHeader as $value)</p>
<p>{</p>
<p>$title = explode('^', $value);</p>
<p>if (trim($title[1]) != '')</p>
<p>{</p>
<p>$aszHeaderNames[strtolower($title[0])] = $title[1];</p>
<p>}</p>
<p>else</p>
<p>$aszHeaderNames[strtolower($title[0])] = $title[0];</p>
<p>}</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>foreach ($aRows[0] as $key => $value)</p>
<p>{</p>
<p>if (strcasecmp($key, "SHAPE_INDEX") == 0 ||</p>
<p>strcasecmp($key, "TILE_INDEX") == 0 ||</p>
<p>strcasecmp($key, "LAYER_INDEX") == 0)</p>
<p>continue;</p>
<p>$szReturnValue .= "<td class=\"subContentArea\"><p class=\"text\">".$key."</p></td>\n";</p>
<p>}</p>
<p>$szReturnValue .= "</tr>\n";</p>
<p>// loop through the results and format each row</p>
<p>foreach ( $aRows as $aRow )</p>
<p>{</p>
<p>// add a row for each</p>
<p>$szReturnValue .= "<tr>\n";</p>
<p>// loop and add a cell for each result</p>
<p>foreach ( $aRow as $key => $xCell )</p>
<p>{</p>
<p>//String comparison to search for fields that should NOT be returnedin query results.</p>
<p>if (strcasecmp($key, "SHAPE_INDEX") == 0 ||</p>
<p>strcasecmp($key, "TILE_INDEX") == 0 ||</p>
<p>strcasecmp($key, "LAYER_INDEX") == 0)</p>
<p>continue;</p>
<p>{</p>
<p>//Look for strings containing an http header. If exists thenformat as a link, if not format as normal text.</p>
<p>if ( stristr ($xCell, 'http://' ))</p>
<p>$szReturnValue .= "<td class=\"subContentArea1\"><pclass=\"text\"><img src='". $xCell."' ></p></td>\n";</p>
<p>else</p>
<p>$szReturnValue .= "<td class=\"subContentArea1\"><pclass=\"text\">". $xCell."</p></td>\n";</p>
<p>}</p>
<p>}</p>
<p>$szReturnValue .= "</tr>\n";</p>
<p>}</p>
<p>}}</p>
<p>else</p>
<p>{</p>
<p>// check if no results on local layer</p>
<p>if ( strcasecmp(substr( $aRows, 0, 26 ), "no results found for layer" ) == 0 )</p>
<p>{</p>
<p>/*</p>
<p>* non-wms no results</p>
<p>*/</p>
<p>array_push( $aszNoResults, $aszLayers[$i] );</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>/*</p>
<p>* THIS IS FOR WMS RESULTS</p>
<p>*/</p>
<p>$szTitle = $aszLayers[$i];</p>
<p>if (isset($aszTitles[$i]))</p>
<p>$szTitle = $aszTitles[$i];</p>
<p>$nTmpCount = count( $gaszWMSResults );</p>
<p>$gaszWMSResults[$nTmpCount][0] = $aRows;</p>
<p>$gaszWMSResults[$nTmpCount][1] = $szTitle;</p>
<p>}</p>
<p>}</p>
<p>// end loop of layers</p></font></div>