[Chameleon] query pop-up with photo?

Jason Fournier jfournier at dmsolutions.ca
Wed Jan 19 20:47:25 EST 2005


If I'm understanding correctly ...

If you use the methodology listed in the FAQ on the Chameleon Tiki you 
shouldn't have to worry about where the information is coming from (ie, 
local, WMS) ... it should be returned to you as an array from the 
executeQuery function.

In the case of the FAQ example the sample query.phtml file should be 
created in the same directory as your template.  The myOnQuery 
javascript function that you create in your template refers to 
query.phtml being accessed by, for instance, a window.open:

function myOnQuery( nX, nY )
{
    var url = 'query.phtml?x=' + nX + '&y=' + nY + '&sid=' + 
document.forms0.sid.value;
    window.open(url,'eventwin','width=675,height=600,
directories=no,location=yes,menubar=no,scrollbars=yes,
status=no,toolbar=no,resizable=yes');
}

In your query.phtml you can use PHP to limit the resulting datasets, 
refer to images, etc. etc.

In the instance you describe you could do something like:

<?php

//snippet - additional code still required above as note in the tiki

     foreach( $aResults as $nLayerIdx => $aResult )
     {
         $oLayer = $oMapSession->oMap->getLayer($nLayerIdx);
         $szName = $oLayer->name;

         if( $szName == 'NAME_OF_LAYER_DESIRED' )
         {
             echo 'fieldA: ' . $aResult['fieldA'] . '<br>';
             echo 'fieldB: ' . $aResult['fieldB'] . '<br>';
             echo 'fieldC: ' . $aResult['fieldC'] . '<br>';
             echo '<img src="./images/'.$aResult['fieldPhoto'].'"><br>';
         }
     }

?>

(Note: the above isn't tested!)

That should be it ... you should get the results you want.  The above 
query.phtml is a snippet of the code shown in the FAQ - you require all 
the other stuff in order for it to work.  As well, the above loop will 
basically drop the query information for any other queryable layer in 
your application.  If you want to query other layers you'll have to add 
that logic to your script.

Jason






enns at abacho.de wrote:
> I'm making some headway in this, but I still need some more details.  In particular when using wms layers.
> In the function you mentioned 'processWMSGetFeatureInfo() ' .....  :
> 1. can I set a foreach to assign an image for the record selected?
> 2. can I show only the fields I want?
> 
> Basically I want fieldA, fieldB, fieldC to show up in the query results pop-up and an associated photo that comes from a path in my fieldPhoto for that point (record) selected.
> 
> In the faq it provided a sample query.phtml but it is not indicated where this would reside in the code to be launched.
> 
> As a newbie, I need as much details as possible.
> 
> ----- original Nachricht --------
> 
> 
> 
> At 02:38 PM 01/14/2005 +0100, enns at abacho.de wrote:
> 
>>I am about to embark on the implementation of the query widget.   Upon clicking on an object (point) I would like to display not only the attributes of that object but also a photo associated to the object in the pop-up.  
>>How do I go about inserting a photo into the pop-up information?  What will the syntax be like in this case?
>>
>>Thanks in advance,
>>
>>David E.
> 
> 
>  I assume you are creating a custom Query widget? You will need to edit the QueryResults.phtml script in  widgets/Query/ directory.
> In particular the formatQueryResults function.  It's easy enough to add an <img src=XXXX> tag in the output.
> QueryResults.phtml is the script which runs to populate the Query Popup window with html.
> 
> I'm assuming that this is a "local" mapfile layer.
> 
> If it's a WMS layer it's a little different. The results are formatted in the processWMSGetFeatureInfo() function.
> 
> Note: you can copy the widgets/Query/ directory to a directory local to your application, make your customizations there and when you start your Chameleon application (index.phtml) add that directory to the CWCExecute() call: eg.
> 
> $oApp->CWCExecute( array($gszAppPath."/widgets" ) );
> Chameleon will use the local Query before the default Query.
> 
> That way only this application will get the custom Query widget.
> 
> Eric
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> <a href='http://lists.maptools.org/mailman/listinfo/chameleon' target='_blank'><u>http://lists.maptools.org/mailman/listinfo/chameleon</u></a>
> 
> 
> --- original Nachricht Ende ----
> 
> 
> 
> Die Abacho-Surftipps:
> - http://www.abacho.com - die pure Suche!
> - http://www.abacho.de - Das starke Informationsportal mit taegl. News,
>   Stories und starker Suchmaschine
> 
> - eBay bietet Ihnen das Beste aus ueber 1,5 Mio.
> Angeboten!- http://nl.hi-media.de/?goto=68174.134580.247.1
> ---------------------------------------------------
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
_____________________________

   Jason Fournier

   DM Solutions Group Inc.
   jfournier at dmsolutions.ca
   www.dmsolutions.ca
   613.565.5056 x18



More information about the Chameleon mailing list