Welcome Guest, Not a member yet? Register   Sign In
Call controller method within library without redirect
#1

Hey!

I'm building a library for CI and I need to run the callback after my logic.

How do i call a controller method within library?

I tried different ways and nothing worked Sad

PHP Code:
$default_controller_callback 'Welcome';
$default_method_callback 'custom_message';

// ERROR:  Undefined property: Welcome::$load
$controller = new $default_controller_callback();
call_user_func(array($controller $default_method_callback));

// ERROR: Got Strict standards: call_user_func() expects parameter 1 to be a valid callback, non-static method 
// Welcome::custom_message() should not be called statically
call_user_func(array($default_controller_callback $default_method_callback)); 

Here is the full library code: https://github.com/russ-ab/CodeIgniter-C...n.php#L192

I want to change the redirect to real callback calling.

Thanks!
Reply


Messages In This Thread
Call controller method within library without redirect - by Russ_AB - 06-01-2017, 06:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB