Welcome Guest, Not a member yet? Register   Sign In
Calling a Controller Function from an External PHP File?
#5

[eluser]Vik[/eluser]
Thanks for the suggestion, Negligence. This will be cool if it works.

I have to include a lot of stuff to define the controller class. Here's what I've got so far:

Code:
$system_folder = "system";
define('BASEPATH', $system_folder.'/');

if (floor(phpversion()) < 5)
{
    load_class('Loader', FALSE);
    require(BASEPATH.'codeigniter/Base4.php');
}
else
{
    require(BASEPATH.'codeigniter/Base5.php');
}

include ('system/libraries/Controller.php');
include ('system/application/controllers/home.php');
$controller = new Controller();
call_user_func(array($controller, 'login_via_smf'));

On the line:

Code:
$controller = new Controller();

...I'm getting the following error:

Quote:Debug Error: system/libraries/Controller.php line 74 - Call to undefined function load_class()

I.e. there's a call to load_class in Controller.php, line 74, that PHP says is undefined. (I'm using PHP 5, so the call to load_class in my code isn't getting executed.)

Where does function load_class get defined? I can't find it yet in the PHP manual _or_ the CI manual! Smile


Messages In This Thread
Calling a Controller Function from an External PHP File? - by El Forum - 12-12-2007, 10:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB