[TYPO3] trying to call some custom code to pass a session into tsfe for access from typoscript... help

Christopher Torgalson bedlamhotel at gmail.com
Mon Nov 12 20:22:09 CET 2007


Hi,

On Nov 12, 2007 8:05 PM, Andrew Davis <junk at avagraphique.com> wrote:
> Hi I am trying to read a session variable, and have it accessable to
> my ts...
>
> we have a cart (different, non typo3 script) that sets a session and
> goes back to typo3. Idf that session is set we want a different menu
> (HMENU, simple stuff) to display.
>
> But since the session isnt set by typo3, not sure how to get that info
> to be accessible by typo3.
>
> we thought to do this:
>
> 1. Make an extension that reads the session and passes it to the tsfe.
> in the extension is this:
>
> function main($content,$conf)   {
>                 $this->conf=$conf;
>                 $this->pi_setPiVarDefaults();
>                 $this->pi_loadLL();
>                 $this->pi_USER_INT_obj=1;       // Configuring so caching is not expected.
> This value means that no cHash params are ever set. We do this,
> because it's a USER_INT object!
>                 $TSFE["read_session"] = $_SESSION['store'];
>
>
>         }
>
>
> 2. then in the ts template we call the function specifically
>
> temp.pass_session = USER
> temp.pass_session.userFunc = tx_core101readsession_pi1->main
>
>
>
> 3. then i do a conditional statement to crete the menu
>
> [globalVar = TSFE:read_session = showcase]
> temp.menu_1_t3.special = list
> temp.menu_1_t3.special.value = 22,23,24,25,9
> [else]
> temp.menu_1_t3.special = list
> temp.menu_1_t3.special.value = 11,22,23,24,25,9
> [end]
>
>
>
>
> but it doesnt seem to be doing anything. Any suggestions? PLease be
> specific.



A small thing that may help--there are apparently API tools for
getting and setting fe user session data. You can read about a couple
in a short section in the TSref [1]--though parts of the TS shown in
the relevant section are obsolete, so your mileage may vary (e.g.
PHP_SCRIPT was replaced by the USER* family of cObjects years ago
now...)


-- 
Christopher Torgalson
http://www.typo3apprentice.com/


[1] http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/14/1/


More information about the TYPO3-english mailing list