[TYPO3] Accessing $GLOBALS['TSFE'] from other PHP scripts
S. Teuber
traveler_in_time at gmx.net
Thu Feb 2 11:02:13 CET 2006
Hi John,
> I am writing a set of flash remoting services that will be used by
> flash movies on my site. I'd like for those remoting scripts to have
> access to some of the data in the TSFE object. What is the simplest
> way to get access to the $GLOBALS['TSFE'] from a non-plug-in php
> script? It's
Global variables are created during runtime of a PHP script and are
"global" (=available) to that script only. The fact that
$GLOBALS['TSFE'] is available in every extension of TYPO3 is related to
the fact that all those extensions are included by a single "master" PHP
script, thus they are all just one script which is build from many
files. After the execution of that script, $GLOBALS['TSFE'] is deleted
and no more available.
If it wasn't the case that every PHP-script has it's own $GLOBALS, we
had a lot of trouble mixing up variables when many users access a
PHP-driven website simultaneously. ;)
There is no way to get variables from another script instance without
putting them in a database or filesystem.
> possible that I don't need the whole TSFE object, my real goal is to
> just let the flash have access to the same user information as the
> front end for purposes of showing user-specific content.
The front end user information is stored in a PHP-Session. You may have
the possibility to access it via the Session-Cookie or, if the user
didn't allow cookies, through the session file (located in /tmp by
default). Try getting the FE-Users session ID (if it's not in the
cookie, it's a GET parameter) and accessing it's data from there.
Sven
More information about the TYPO3-english
mailing list