[Chameleon] Problem with executeQuery
ventouse at free.fr
ventouse at free.fr
Fri May 19 05:05:04 EDT 2006
Hi !
Ive read the tiki pages about the custom query (executequery in
query-utils.php), and I still have problems making this thing work.
Here is my code
In html main page
<script language="JavaScript" type="text/javascript">
function myOnLoad()
{
CWC2OnLoadFunction();
goEventManager.registerForEvent( 'ON_QUERY', 'myOnQuery' );
}
</script>
<script language="JavaScript" type="text/javascript">
function myOnQuery(nX,nY)
{
var
url='query.phtml?=&x'+nX+'&y='+nY+'&sid='+document.forms[0].sid.value ;
window.open(url,'eventwin',width=500,height=600);
}
And in query.phtml
// check for a session
if( !isset( $_GET[ 'sid'] ) )
die('no session detected');
// define some vars
define("LOAD_MAPSESSION", 1);
define( 'CHAMELEON_PATH', '/ms4w/apps/chameleon/htdocs/');
// include the supporting php functions
include(CHAMELEON_PATH."widgets/session.inc.php");
include(CHAMELEON_PATH."widgets/query_utils.php");
// execute the query based on passed coords and the mapsession
$aResults = executeQuery( $oMapSession, $_GET['x'], $_GET['y'] );
foreach( $aResults as $nLayerIdx => $aResult )
{ echo $nLayerIdx;
$oLayer = $oMapSession->oMap->getLayer($nLayerIdx);
$szName = $oLayer->name;
foreach($aResult as $aRow)
{
echo 'Layer Name: ' . $szName . '<br>';
}
}
The whole code seems to work well except i get a blank page in my result popup
window...
The adress of the generated result.phtml seems good (eg :
http://localhost/chameleon/samples/query.phtml?=&x95&y=71&sid=446d87ea5a88b)
and the sid seem to have been transmitted (isntt it ?).
In addition ive tried and use the usual query widget and theres no problem
getting the shape file info.
So, is it a session related problem ?
Thanx in advance
E. SEGUIN
PS : the map file code if it could be useful.
LAYER
NAME monde
METADATA
"DESCRIPTION" "Systиme Gйodйsique"
"GROUP" "Polygon"
"LAYER" "Systиme Gйodйsique"
END
TYPE POLYGON
STATUS ON
DATA monde
CLASS
OUTLINECOLOR 50 50 50
COLOR 255 255 155
END
TEMPLATE "dummy.html"
END # layer
More information about the Chameleon
mailing list