Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Session is reset when using php include
My problem is quite complicated to explain because there is a shopping system involved for which I am trying to use textpattern as a seperated CMS.
It almost works but there is a problem with the session.
So I try to break it down to the facts that are relevant.
In my textpattern “page” I include some php file via <txp:php> include ‘somefile.php’; </txp:php>.
Via print_r($_SESSION); in somefile.php I ouptut the session.
If I call somefile.php directly in the browser it shows the session. Even if I reload this site.
If I call my textpattern URL it shows me the correct session, but after a reload it is all reset.
Any chance to say something about this problem without going more into detail?
Is there some natural behavior of textpattern when using an include in the pages that might cause that problem?
My Textpattern version is 4.8
Would be great if someone had an idea.
Offline
Re: Session is reset when using php include
As far as I recall, we don’t touch sessions in core, besides during /setup. Are you running any plugins such as:
- MLP (I presume not, since I don’t think it works in 4.8)
- yab_shop
Both of those mess with session variables and I’ve known them to cause weird behaviour like you mention.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Session is reset when using php include
Thanks Stef for your quick opinion about it.
I just disabled all plugins. Same result.
Offline
Re: Session is reset when using php include
I solved this problem now, by including the metioned somefile.php into the index.php of textpattern directly.
I still do not really know if it is has more to do with the shopping system or more with textpattern, but the session does not get lost now.
Last edited by demoncleaner (2020-01-02 16:23:15)
Offline
Re: Session is reset when using php include
demoncleaner wrote #320792:
I solved this problem now, by including the metioned somefile.php into the index.php of textpattern directly.
Dunno what happens, I have no problems with sessions when including via <txp:php />
. Anyway, if it works now, you could try setting
$txpcfg['pre_publish_script'] = 'path/to/somefile.php';
in config.php
rather than modifying index.php
.
Offline
Re: Session is reset when using php include
Magic! And much better than my approach. Thx a lot.
Offline