[Chameleon] general php question about globals

Abbott,Arthur Arthur.Abbott at nscc.ca
Tue May 16 15:10:14 EDT 2006


Everyone,
 
I'm currently working with the query widget I have code that finds a value within a shape file. This code
is in QueryResult.phtml. I would like to pass the value back to Query.Widget.php. I thought about using
global variables.
 
I've placed the value in the $GLOBALS array inside QueryResult. When I'm back in Query.Widget the value is unchanged...
 
I set the value in QueryResult with the line:               $GLOBALS['gblurl'] = $url;
 
When I look at the value outside of QueryResult the value does not contain the value it should.  Am I looking at
it in the wrong place? I'm currently examining the global at the end of the function that does the popup for the 
query widget...
 
function {$szJsFunctionName}(e)
{
    if ({$this->mszHTMLForm}.NAV_CMD.value != "{$this->mszCmd}")
        return true;
       
    MapWgetMouse(e);
    if ( !MapWinsideMap() )
        return true;
    nX = {$this->mszHTMLForm}.MAP_CURSOR_POS_X.value;
    nY = {$this->mszHTMLForm}.MAP_CURSOR_POS_Y.value;
    szNav = "NAV_INPUT_COORDINATES=" + nX + "," + nY;
    
    if ({$szPopupResults})
    {
        szPopupURL = "{$szPopupURL}";
        szPopupName = "{$szPopupName}";
        szPopupOptions = "{$szPopupOptions}";
        szPopupURL = szPopupURL + "&" + szNav;
        window.open( szPopupURL, szPopupName, szPopupOptions );
    }
    if ({$szHighlightResults})
    {
        var queryCoords = nX + "," + nY;
        var img = CWCDHTML_GetImage( 'MapLayerDivImg' );
        img.src = gMapDHTMLURL + "&run_query=1&gszQueryCoords=" + queryCoords + "&gszPersistentQuery={$szPersistentResults}";
        window.status = img.src;
    }
    if ("{$this->mszIFrameName}" != "" )
    {
        szPopupURL = "{$szPopupURL}";
        szPopupURL = szPopupURL + "&" + szNav;
        window.frames['{$this->mszIFrameName}'].location.href = szPopupURL + "&run_query=1";
    }
    if ({$szSubmitPage})
    {
        {$this->mszHTMLForm}.submit();
    }
    goEventManager.triggerEvent( 'ON_QUERY', nX, nY );
 
    //Examine the contents of global value set in QueryResult
    alert("{$GLOBALS['gblurl']}")
    
    return true;
}
 
If anybody has an idea as to why the value is not updating, it would be greatly appreciated,
 
Arthur



More information about the Chameleon mailing list