[Chameleon] Globals

Julien-Samuel Lacroix jlacroix at mapgears.com
Wed May 17 10:12:47 EDT 2006


Hi,
First make sure that your code that assign value in the $_SESSION array 
is after the serie of include_once() at the beginning of the file.

Then in the Query.widget.php, in the ParseURL() function, try to do:
echo $_SESSION['junk'];

You will see if the value is set or not. Note that the main page have to 
reset somehow to re-process the widget. Is it the case?

Julien

Abbott,Arthur wrote:
> Ok, I switched over to using a $SESSION variable. Unfortunately I have the same behaviour. When I try to use the value in QueryWidget that was supposed to be set in QueryResults, the value does not change. This is wierd since i know its changing in QueryResult. I echoed the value before and after and the value does change.
> 
>   echo $_SESSION['junk'];
>   $_SESSION['junk'] = $url;
>   echo $_SESSION['junk'];
> 
> Using this code, the value of session is changed and i can see the change, yet when im in QueryWidget I dont see the new value.
> 
> I wonder, am i trying to use the variable in the wrong place? I am currently trying to use the value inside of the QueryWMouseClick function of QueryWidget. should I be trying to use it someplace else?
>  
> Arthur
> 
>  
> 
> 
>>Hi,
>>Since QueryResults.phtml is a script beside Chameleon (not in it), it is
>>called in a different window. So the GLOBALS won't work. You need to use
>>the $SESSION variables instead.
>>
>>Julien
>>
>>Abbott,Arthur wrote:
>>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
>>
>>_______________________________________________
>>Chameleon mailing list
>>Chameleon at lists.maptools.org
>>http://lists.maptools.org/mailman/listinfo/chameleon <https://webmail.nscc.ca/exchweb/bin/redir.asp?URL=http://lists.maptools.org/mailman/listinfo/chameleon> 
> 
> 
> --
> Julien-Samuel Lacroix
> Mapgears
> http://www.mapgears.com/ <https://webmail.nscc.ca/exchweb/bin/redir.asp?URL=http://www.mapgears.com/> 
> 
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/


More information about the Chameleon mailing list