[maplab-users] code for custom query

charley cheng chengcharlie2003 at yahoo.ca
Thu Aug 19 00:00:01 EDT 2004


Hi! Alberto,
Thank you very much for you code.
I really need to modify the query.phtml to displaying the attribute information I want to display.
Could you give a little more explaination about you code?
INFO, NUM_FOGLIO, NUM_PART, AREA are the attribute in shapefile you want to display. What is "INFO_ID" and "ESPR1"?
 
Thank you very much for your time.
 
Charlie

Alberto Cavalli <alberto.cavalli at sintranet.it> wrote:
Hi dear, for the benefit of the ewsgroup I'm going to post the code to make
a custom query with some specification:
The file that need to be modificated is query.phtml.in the proximity of line
180 you can find a line like this: 
// loop and use key for titles
foreach ($aRows[0] as $key => $value)



starting fron here replace it with this code:

// loop and use key for titles (add here only the field of dbf that you
want to display)
foreach ($aRows[0] as $key => $value)
{
if (strcasecmp($key, "INFO") == "INFO" ||
strcasecmp($key, "NUM_FOGLIO") == "NUM_FOGLIO" ||
strcasecmp($key, "NUM_PART") == "NUM_PART" ||
strcasecmp($key, "AREA") == "AREA" )

$szReturnValue .= "face=\"Arial, Helvetica, sans-serif\" size=\"2\">".key."\n";
}
$szReturnValue .= "\n";

// loop through the results and format each row
foreach ( $aRows as $aRow )
{
// add a row for each
$szReturnValue .= "\n";

// loop and add a cell for each result (add here only the
field thath you don't want to display)
foreach ( $aRow as $key => $xCell )
{
if (strcasecmp($key, "INFO_ID") == 0 ||
strcasecmp($key, "ESPR1") == 0)
continue;
$szReturnValue .= "face=\"Arial, Helvetica, sans-serif\" size=\"2\">".$xCell."\n";
}

$szReturnValue .= "\n";
}



I hope that this one can help someone
bye
Alberto




















_______________________________________________
Maplab-users mailing list
Maplab-users at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/maplab-users



---------------------------------
Post your free ad now! Yahoo! Canada Personals
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/maplab-users/attachments/20040819/4861d7cf/attachment.htm


More information about the Maplab-users mailing list