[Chameleon] finding locations and parsing session id

Jacob Delfos jacob.delfos at maunsell.com
Tue Mar 15 19:37:06 EST 2005


Peter,

I'll send you a copy of a widget I made which lets you search attributes of a shapefile (e.g. name) and zooms to the object. You could use a placename dataset or something similar to do the search on (let me know if you don't know where to find one). 
If anyone else wants it, e-mail me. Feedback will help me debug.

regards,

Jacob



-----Original Message-----
From: chameleon-bounces at lists.maptools.org [mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Paul Spencer
Sent: 15 March 2005 20:27
To: Peter Thomann
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] finding locations and parsing session id

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.
> 
_______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/chameleon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20050316/4f2ff3da/attachment.html


More information about the Chameleon mailing list