Categories > TinyButStrong general >

Accessing SESSION

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Adrian Madrid
Date: 2004-03-11
Time: 22:04

Accessing SESSION

How do you access SESSION vars from a template?
By: RwD
Date: 2004-03-11
Time: 22:31

Re: Accessing SESSION

you can't just use them like normal???
By: Adrian Madrid
Date: 2004-03-11
Time: 23:13

Re: Accessing SESSION

Sorry, was doing [var.SESSION] instead of [var._SESSION].

BTW, a mention of SESSION variables should be good in the manual. It mentions GLOBALS but it's not evident, at leat to my beaten brain, that session variables could be accesses also. Do _GET/_POST/_REQUEST get the same treatment?
By: RwD
Date: 2004-03-12
Time: 10:58

Re: Accessing SESSION

I, euh, think that it doesn't matter what variable it is. as long as it is available at the level where tbs runs (normally global)

so anyt variable declared like
$blah = 'lala';
on a global scope will be available to tbs when the tbs object was instantiated at that same scope

_GET/_POST/_REQUEST are global variables, so if tbs was made from for example the php file in the url and not within a function, then tbs should be able to access the variable

-------------------------------------------

One thing I do not know though, and would like to know, is how tbs handles array variables. so take
_SESSION for instance, this is an array variable
_SESSION['blah'] could be a good example of a session variable stored in _SESSION.

How do I access _SESSION['blah']
(besides from the fact that php makes it a normal var $blah too)

TinyButStrong Error (Merge Php Var): Can't merge {var._SESSION{'blah']] because there is no corresponding PHP variable. This message can be cancelled using the 'noerr' parameter.

{var._SESSION['blah']}
also notice the bracket error in the message, keep in mind that I use curly brackets at the moment instead of the []
By: Adrian Madrid
Date: 2004-03-12
Time: 17:24

Re: Accessing SESSION

In your case try
[var._SESSION.blah]
and it should work instead of _SESSION['blah']. What did not work is setting
$_SESSION['x']['y'] = 'Hello';
and then calling
[var._SESSION.x.y]
.
By: RwD
Date: 2004-03-13
Time: 00:47

Re: Accessing SESSION

so it does work 1 level deep, but not 2 levels??