If I include index.php that way, I just get a frontend 404 page o_O
(yes, the path is correct)
The version I posted last works perfectly...
Hi,
Have you a solution to retrieve the $_SESSION array ? Trying yours but it remain always empty.
My script is an external php file, not in manager.
Your external script is called from a module? You can try to serialize() it and send it... ok I’ve wrote the first thing that ran into my mind!
I remember you actually have to ignite session_start() before the rest of the code... I’m wrong?
Quote from: sirlancelot at Apr 22, 2008, 11:05 AM
You guys are making it way too complicated...
If you insist on not initializing MODx in API mode you can start the session like this:<?php
$base_path = '/var/www/modx/';
include($base_path.'manager/includes/config.inc.php');
startCMSSession();
?>
But honestly, use the API method I described above, it does everything you need it to do and is mostly forward compatible with 0.9.7.
Just a note: StartCMSSession() no longer exists in 0.9.7s so that solution won’t be forward-compatible.
Here’s some fairly clumsy code from SPForm that might be relevant:
if (file_exists("../../../manager/includes/config.inc.php") ) { // 0.9.6 - make sessions work
require_once "../../../manager/includes/config.inc.php";
startCMSSession(); // moved here from class file
} else { // For 0.9.7
require_once "../../../config.core.php";
// include the modX class
require_once "../../../core/model/modx/modx.class.php";
// start output buffering
//ob_start();
// Create an instance of the modX class
$modx= new modX();
$modx->initialize('web');
}