[Chameleon] how to read user variables in scripts files diferents
to template file
Julien-Samuel Lacroix
jlacroix at mapgears.com
Tue Jul 3 10:05:56 EDT 2007
Hi,
If you want CI to become a session variable, set it in the session directly:
$_SESSION['CI'] = true;
The $oApp->setVar(...) function simply set the value in the URL variable
as if they were sent from a HTML form. This won't save them anywhere.
To access the SID or CI variable, since you pass them in the URL using
the post method, access them with:
echo $_GET['CI'];
or
echo $_REQUEST['CI'];
Julien
Alexys Herleym Rodriguez Avellaneda wrote:
> Hi,
>
> In the Initialization Script i declare my own variable:
> ..
> ..
> $oApp->CWCInitialize( $szTemplate, $szMapFile);
> $oApp->setVar( 'SID', session_id() );
> $oApp->setVar( 'CI', TRUE );
> ...
>
>
>
> In the template file i can read the SID or CI variable (my own variables):
>
> [$SID|$]
>
> [$CI|$]
>
>
>
> When i call one php page from template file and i need to read the
> chameleon session variables i do:
>
>
>
> 1- i pass the SID in the url:
>
> /login.phtml?sid=[$SID|$]/
>
> 2- and i call the chameleon session in the php file (login.phtml):
>
> /<?/
>
> / include_once("../../chameleon/htdocs/widgets/session.inc.php");
> installSessionDirectoryHandler();
> initializeSession();/
>
> / ../
>
> / ../
>
> / ?>/
>
>
>
> Then i can use all chameleon session variables with $_SESSION
> from (inside) login.phtml :
>
> /<?/
>
> / include_once("../../chameleon/htdocs/widgets/session.inc.php");
> installSessionDirectoryHandler();
> initializeSession();/
>
> / //all chameleon variables/
>
> / print_r ($_SESSION);/
>
> / //only one chameleon variable/
>
> / print_r ($_SESSION['gszAppPath']);/
>
> /?>/
>
>
>
> But i need to know how to see my own CI or SID variable
> inside login.phtml?. This code doesn't work:
>
> /<?/
>
> / include_once("../../chameleon/htdocs/widgets/session.inc.php");
> installSessionDirectoryHandler();
> initializeSession();/
>
> / //this doen't work/
>
> / echo $_SESSION['CI'];/
>
> / //this doen't work
> echo $_GLOBALS['CI'];/
>
> / //this doen't work/
>
> / echo $_POST['CI'];/
>
> /?>/
>
> /<!-- //this doen't work -->/
>
> /<a href="somewhere.php?sid=[$CI|default$]">link</a>/
>
>
>
> And this code in the Initialization Script: /$oApp->setVar( 'CI', TRUE
> );/ mean that CI is a session variable?, or is a chameleon session
> variable? or both?, or none?
>
>
>
> Thanks a lot.
>
>
>
> Alexys
>
>
> ------------------------------------------------------------------------
>
> ¡Descubre una nueva forma de obtener respuestas a tus preguntas!
> Entra en Yahoo! Respuestas
> <http://us.rd.yahoo.com/mail/es/tagline/answers/*http://es.answers.yahoo.com/;_ylc=X3oDMTEzNWwxbTZtBF9TAzIxMTQ3MTQxOTAEc2VjA01haWwEc2xrA3RhZ2xpbmVz>.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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