1

I found this EE Bootstrap unit: https://github.com/blocka/ExpressionEngine-Bootstrap

It "bootstraps" the EE environment, so you use the EE "super object". However, I'm running into problems trying to use it with EE 2.5.2.

I have set my system_path as required. The script is trying to include Compat.php, which isn't in 2.5.2, so I comment out that line. The script is also trying to include Base5.php, which also is not in 2.5.2, so I comment out that line.

Now, when running, I get an exception: "Class 'Controller' not found" at this line

class A extends Controller {

Any ideas how to fix this for 2.5.2?

Here's the source code that I have:

<?php
if (!isset($system_path)) {
    $system_path = './na_cms/';
}

$assign_to_config['enable_query_strings'] = TRUE;
$assign_to_config['subclass_prefix'] = 'EE_';


if (realpath($system_path) !== FALSE)
{
    $system_path = realpath($system_path).'/';
}

// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';


define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('EXT', '.php');
define('APPPATH', $system_path.'expressionengine/');
define('FCPATH', str_replace(SELF, '', __FILE__));
define('SYSDIR', trim(strrchr(trim(str_replace("\\", "/", $system_path), '/'), '/'), '/'));
if(!defined('UTF8_ENABLED')) define('UTF8_ENABLED', false);
if(!defined('CI_VERSION')) define('CI_VERSION', '2.0.1');
//define('AJAX_REQUEST',false);
define('DEBUG',false);

require(BASEPATH.'core/Common'.EXT);
// require(BASEPATH.'core/Compat'.EXT);
require(APPPATH.'config/constants'.EXT);

$CFG =& load_class('Config', 'core');
$URI =& load_class('URI', 'core');
$IN =& load_class('Input', 'core'); 
$OUT =& load_class('Output', 'core');
$LANG =& load_class('Lang', 'core');
// require(BASEPATH.'core/Base5'.EXT);

$loader = load_class('Loader', 'core');

// Load the base controller class
require BASEPATH.'core/Controller'.EXT;


class A extends Controller {

}

$EE = new A;
$EE->core->_initialize_core();

1 Answer 1

1

Actually, I found a fork that supports EE2.5.2: https://github.com/rsanchez/ExpressionEngine-Bootstrap I am leaving this question for reference and will accept my own answer when avail.

<?php
if (!isset($system_path)) {
    $system_path = './na_cms/';
}

$assign_to_config['enable_query_strings'] = TRUE;
$assign_to_config['subclass_prefix'] = 'EE_';


if (realpath($system_path) !== FALSE)
{
    $system_path = realpath($system_path).'/';
}

// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';


define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('EXT', '.php');
if(!defined('BASEPATH')) define('BASEPATH', str_replace("\\", "/", $system_path.'codeigniter/system/'));
define('APPPATH', $system_path.'expressionengine/');
define('FCPATH', str_replace(SELF, '', __FILE__));
define('SYSDIR', trim(strrchr(trim(str_replace("\\", "/", $system_path), '/'), '/'), '/'));
if(!defined('UTF8_ENABLED')) define('UTF8_ENABLED', false);
if(!defined('CI_VERSION')) define('CI_VERSION', '2.0.1');
//define('AJAX_REQUEST',false);
define('DEBUG',false);

require BASEPATH.'core/Common'.EXT;
require APPPATH.'config/constants'.EXT;

$CFG =& load_class('Config', 'core');
$URI =& load_class('URI', 'core');
$IN =& load_class('Input', 'core'); 
$OUT =& load_class('Output', 'core');
$LANG =& load_class('Lang', 'core');
$SEC =& load_class('Security', 'core');

$loader = load_class('Loader', 'core');

// Load the base controller class
require BASEPATH.'core/Controller'.EXT;

function &get_instance()
{
    return CI_Controller::get_instance();
}

class EE_Bootstrap extends CI_Controller {}

$EE = new EE_Bootstrap;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.