[Chameleon] general php question about globals

Julien-Samuel Lacroix jlacroix at mapgears.com
Tue May 16 15:32:43 EDT 2006


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

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


More information about the Chameleon mailing list