[Fwd: Re: [maplab-users] links from map to jpg]

kgrootendorst at baird.com kgrootendorst at baird.com
Thu Sep 2 09:03:22 EDT 2004


Steffan,
Thanks for your help.  Now my code displays the query window, and lists 
the column headings (Long DD, Lat DD, MS PATH2), but does not populate 
these fields with any attributes.
When I echo($key), the value is 'LAYER_INDEX', and when I echo($xCell), 
the value is '5'

The fields Long_DD, Lat_DD, and MS_PATH2 are the only columns in my 
shapefile, if you don't count the default ESRI columns of FID and shape.

Below is the 2 snippets of code I have added to query.phtml to get this 
far:

Snippet 1:
//***********ADDED FOR 
HYPERLINK***************************************************************

            // loop and use key for titles
            // $Key is equal to the attribute name, which is also the 
header of column

            foreach ($aRows[0] as $key => $value)
            {
                        // The purpose of this if loop is to find the only 
attribute name we want to display

                        if (strcasecmp($key, "Long_DD") == "Long_DD" ||
                                strcasecmp($key, "Lat_DD") == "Lat_DD" ||
                                strcasecmp($key, "MS_PATH2") == 
"MS_PATH2")
 
 
                //$szReturnValue .= "<td bgcolor=\"E2EFF5\"><font 
face=\"Arial, Helvetica, sans-serif\" size=\"2\">".$key."</font></td>\n";
                $szReturnValue = $szReturnValue."<td 
bgcolor=\"E2EFF5\">"."<font face=\"Arial, Helvetica, sans-serif\" 
size=\"2\">".$key."</font></td>\n";
            }

//*********************************************************************************************

Snippet 2:
//***********ADDED FOR 
HYPERLINK***************************************************************

                // loop and add a cell for each result
                foreach ( $aRow as $xCell )
                {
 
                // $xCell is the attribute value, in this case,when the 
$key attribute name is equal to "Long_DD" and "Lat_DD" only display the 
value of attribute.

                if ((strcasecmp($key, "Long_DD") == 0) ||
                    (strcasecmp($key, "Lat_DD") == 0))
                {$szReturnValue .= "<td bgcolor=\"#ffffff\"><font 
face=\"Arial, Helvetica, sans-serif\" size=\"2\">". 
$xCell."</font></td>\n";}

                //when the attribute name is equal to MS_PATH2, hyperlink 
according to the value of attribute, the attribute value of MS_PATH2 
should be simliar as http://localhost/photoalbum/image.jpg 
                //photoalbum folder with images is put at your web server.

                else if (strcasecmp($key, "MS_PATH2") == 0)
 
                        {$szReturnValue .= "<td bgcolor=\"#ffffff\"> <a 
href=\"".$xCell."\"> Click here to document</a></td>\n";} 
                }
               // $szReturnValue .= "</tr>\n";
            }

//*********************************************************************************************




Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/maplab-users/attachments/20040902/7c410fd2/attachment-0001.htm


More information about the Maplab-users mailing list