Hi,
For one site, I need to call the session_start() PHP function to see if the browser accepts cookies.
As it tries setting a cookie through the HTTP header, this function must be called before anything else; even the DOCTYPE.
I call session_start() from within a snippet.
I assume that a snippet works exactly as if its PHP code was directly included into the webpage (although I know this to be impossible with MODx).
Therefore there is no other place for my snippet call that the top of the MODx template I use.
It seems however that session_start() works even when the snippet is called from another location.
In the case of documents, I know that session_start() is already called by MODx.
Maybe is session_start() robust enough to be called after the header without displaying errors and would simply have no influence in that case.
So, I’m wondering if it is totally useless to call session_start() when using MODx and especially when running a snippet ?
Who knows more about this ?
Thanks.
Bump on this one! I have some legacy functionality for a newly "MODX-ified" site and it uses session_start() in one of the scripts. The legacy stuff on the front end (on MODX resource pages) ONLY works when I'm logged into the MODX manager. Otherwise it throws a 503 Page Not Found error. Halp!?