[Chameleon] finding locations and parsing session id

Paul Spencer pspencer at dmsolutions.ca
Tue Mar 15 07:26:37 EST 2005


Peter,

the session id can be accessed in several ways.

PHP
---

you have access to a pre-defined constant SID that contains a 
URL-friendly form of the session id, as in:

$szURL = "http://somewhere.php?".SID;

note it is a constant, not a PHP variable so there is no '$' and it is 
UPPERCASE.  SID evalutes to the equivalent of:

$szURL = "http://somewhere.php?sid=".session_id();

which is more likely to be used in form variables,

echo "<input type='hidden' name='sid' value='".session_id()."'>";

JavaScript
----------

you have two options.  The session id may already be in hidden form 
variables in the page, you can access through:

var sid = document.forms[0].sid.value;

The second option is to embed the sid in the page using the Chameleon 
pre-processor.  In your index.phtml, after $oApp->CWCInitialize(); call

$oApp->setVar( 'SID', session_id() );

then in your template, you can place [$SID|$] whereever you need the 
sid.  For instance:

<a href="somewhere.php?sid=[$SID|$]">link</a>

For your second question, you can use the Locate widget but it only has 
services that are specific to Canada right now.  It is built to be 
extensible with new locator services but it would require some time and 
effort to understand how the code works before you could add a new 
locator service to the existing widget.

Cheers

Paul

Peter Thomann wrote:
> ok i have 2 problems one is very easy i just cant find it
> what is the name of the session-id variable inside chameleon cause i need
> links i my mouse-pointer-query that points on a special position in the map
> i calculate the links out of the shapefiles.
> 
> the other problem is that i need some kind of widget, wich can find me a
> special place like a city or something. tried out the locate widget but i
> cant figure out how to use it for my map.
> 


More information about the Chameleon mailing list