I have created a function in application/helpers/ which works fine when accessing from ci. Now I want to call the same function from outside ci i.e., from core PHP file. But I'm not able to do so.
Below is the approach tried.
Created a test.php outside ci and below is the code:
<?php
$filepath = dirname(__FILE__);
ob_start();
require_once($filepath.'/ci/index.php');
ob_get_clean();
return $CI;
?>
In another core PHP file, test2.php, below is the code:
$CI = require_once('test.php');
echo $CI->config->item('base_url');
some_helper_function($param1, $param2);
Error message:
Fatal error: Call to a member function item() on a non-object in <path>/Utf8.php on line 47
Folder structure:
test.php
test2.php
ci/application/helpers/test_helper.php (contains some_helper_function())
Any suggestions?