Categories > TinyButStrong general >

TBS->Show() destroys part of the $_SESSION

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: XorCo
Date: 2011-09-20
Time: 16:10

TBS->Show() destroys part of the $_SESSION

Hi,

We have read the post http://www.tinybutstrong.com/forum.php?thr=193 where he seems to have quite a similar problem.
Here example of the problem I am having:

With my browser, I go on first.php where I have this code:
session_start()
print_r($_SESSION['object']);
$TBS->Show();
Browser prints the $_SESSION['object'] correctly and $TBS->Show() works fine.

Directly after this I go on second.php where I have this code:
session_start()
print_r($_SESSION['object']);
Browser returns from time to time an empty page even if I repeat those steps.

Conclusion? $TBS->Show() destroys "sometimes" the session? We have tried to change the $TBS->Render into TBS_OUTPUT but that doesn't solve the problem.

We have been trying to solve this problem since a month now and we are desperate.
Any help will be welcome.

Alex & Jag


By: Skrol29
Date: 2011-09-20
Time: 18:20

Re: TBS->Show() destroys part of the $_SESSION

Hi,

> I go on second.php

Do you mean the "first.php" script includes "second.php", or do you mean the browser calls "first.php" and then "second.php" ?

TBS does not edit any variables, and does not event read $_SESSION by its own.

But the default behavior is that $TBS->Show() performs an exit() at its end.
By: XorCo
Date: 2011-09-20
Time: 19:03

Re: TBS->Show() destroys part of the $_SESSION

Hi,

Thx for your reply. The browser goes on "first.php" and then on "second.php".
Why are the $_SESSION variables sometimes deleted?
Maybe some wrong variables I asked TBS to merge?
By: Skrol29
Date: 2011-09-21
Time: 02:00

Re: TBS->Show() destroys part of the $_SESSION

> Maybe some wrong variables I asked TBS to merge?

I don't think so.

> Why are the $_SESSION variables sometimes deleted?

Difficult to say without code analysis. I think it has nothing to do with TBS. Do you have a piece of code that can reproduce the bug ?
By: XorCo
Date: 2011-09-21
Time: 13:12

Re: TBS->Show() destroys part of the $_SESSION

Hey Skrol29,

I have been testing a bit more and it doesn't seem to be $TBS->Show() after all.
I am using subtemplates and this may be the problem.

This is what I have in my main template:
[onload;script=primary.php;subtpl;getbody]          
[onload;script=auxiliary.php;subtpl;getbody]

The problem is that primary.php and auxiliary.php use both the same $_SESSION['object'].
How can I load one template before the other? What is the difference between onload and onshow?

Thx a lot for your help!!
By: XorCo
Date: 2011-09-21
Time: 23:43

Re: TBS->Show() destroys part of the $_SESSION

Isn't there any way to execute the first sub template as shown above and execute the other one only after the first one has been fully executed?
By: Skrol29
Date: 2011-09-22
Time: 15:03

Re: TBS->Show() destroys part of the $_SESSION

> What is the difference between onload and onshow?

[onload] tags are merged during LoadTemplate()
[onshow] tags are merged during Show()

> Isn't there any way to execute the first sub template

[onload] and [onshow] are merged in order of their apparition.
Nevertheless, you can ensure the order of merging doing something like this :

HTML:
[insert1;script=primary.php;subtpl;getbody]         
[insert2;script=auxiliary.php;subtpl;getbody]

PHP:
$TBS->MergeField('insert1','');
$TBS->MergeField('insert2','');