<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>I didn't use templates but I used the following
solution:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1) I added some metadata to map file for
example:</FONT></DIV>
<DIV><FONT face=Arial size=2>
METADATA<BR> "DESCRIPTION"
"Small park"<BR> "RESULT_ALIAS" "Code
Name Altitude Type Area"<BR> "RESULT_FIELDS"
"Bio_cd Bio_na Bio_qt Bio_tp Bio_sup"<BR> END</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>2) I added the following routine to query.phtml
file:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>/************************************************************************/<BR>/*
function
GMapDumpQueryResults()
*/<BR>/*
*/<BR>/* Produce a table with query
results.
*/<BR>/************************************************************************/<BR>function
GMapDumpQueryResults($gpoMap )<BR>{</FONT></DIV>
<DIV><FONT face=Arial size=2> $numResultsTotal =
0;<BR> for($iLayer=0; $iLayer < $gpoMap->numlayers;
$iLayer++)<BR> {<BR>
$oLayer = $gpoMap->GetLayer($iLayer);</FONT></DIV>
<DIV><FONT face=Arial size=2>
$numResults = $oLayer->getNumResults();</FONT></DIV>
<DIV><FONT face=Arial size=2> if
($numResults ==
0)<BR>
continue; // No results in this layer</FONT></DIV>
<DIV><FONT face=Arial size=2> // Open
layer's table... take the list of fields to display from
<BR> // the "HEADERRESULT_FIELDS"
metadata in the layer object.<BR> // open
the layer to make the shape properties available<BR> if ( strpos(
strtoupper( ms_GetVersion() ), "VERSION 3.6") > 0 )<BR>
$oLayer->open( $gpoMap->shapepath );<BR> else
<BR> $oLayer->open();</FONT></DIV>
<DIV><FONT face=Arial size=2>
$selFields = explode(" ",
$oLayer->getMetaData("RESULT_FIELDS"));<BR>
$selNameFields = explode(" ",
$oLayer->getMetaData("RESULT_ALIAS"));<BR>
printf("<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2
WIDTH=100%%>\n");<BR>
printf("<TR>\n");<BR>
printf("<TD COLSPAN=%d BGCOLOR=#C1D8E3>",
sizeof($selFields));<BR>
printf("<CENTER> %s </CENTER>",
$oLayer->getMetaData("DESCRIPTION"));<BR>
printf("</TR>\n"); <BR>
//<BR> // Table header: attribute
names...<BR>
//<BR>
printf("<TR>\n"); <BR> for
($iField=0; $iField < sizeof($selFields);
$iField++)<BR>
{<BR>
printf("<TD
BGCOLOR=#E2EFF5>");<BR>
printf("%s",$selNameFields[$iField]);<BR>
printf("</TD>");<BR>
}<BR>
printf("</TR>\n"); </FONT></DIV>
<DIV><FONT face=Arial size=2> // One
row in table for each selected
record<BR> //</FONT></DIV>
<DIV><FONT face=Arial size=2> for
($iRes=0; $iRes < $numResults;
$iRes++)<BR>
{<BR> $oRes =
$oLayer->getResult($iRes);</FONT></DIV>
<DIV><FONT face=Arial
size=2>
$oShape =
$oLayer->getShape($oRes->tileindex,$oRes->shapeindex);</FONT></DIV>
<DIV><FONT face=Arial
size=2>
printf("<TR>\n"); </FONT></DIV>
<DIV><FONT face=Arial
size=2>
printf("<!-- bounds(%f, %f)-(%f, %f)-->\n",
<BR>
$oShape->bounds->minx,
$oShape->bounds->miny,<BR>
$oShape->bounds->maxx,
$oShape->bounds->maxy);<BR>
<BR>
for($iField=0; $iField < sizeof($selFields);
$iField++)<BR>
{<BR>
printf("<TD
BGCOLOR=#FFFFFF>");<BR>
printf("%s",
$oShape->values[strtoupper($selFields[$iField])]);<BR>
printf("</TD>");<BR>
}<BR>
printf("</TR>\n"); </FONT></DIV>
<DIV><FONT face=Arial
size=2>
$oShape->free();</FONT></DIV>
<DIV><FONT face=Arial
size=2>
$numResultsTotal++;<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2>
$oLayer->close();</FONT></DIV>
<DIV><FONT face=Arial size=2>
printf("</TABLE>\n");<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2> if ($numResultsTotal ==
0)<BR> echo "Nothing found at query
location.";</FONT></DIV>
<DIV><FONT face=Arial size=2>}<BR><BR>3) I modified the query.phtml file to call
the routine:</FONT></DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2> // format the query
results<BR> //$szResults = formatQueryResults( $oResultSet,
$aszLayers,$aszTemplate);<BR> $szResults =GMapDumpQueryResults
( $oMap);</FONT></DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>4) I hope I don't forget
nothing...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>--------------------------------------------------------------------<BR>Lorenzino
Vaccari<BR>Provincia Autonoma di Trento<BR>Servizio Urbanistica e Tutela del
Paesaggio<BR>Sistema Informativo Territoriale<BR>Italy</FONT></DIV>
<DIV><FONT face=Arial
size=2>--------------------------------------------------------------------</DIV></FONT></FONT></DIV></BODY></HTML>