Reputation: 4396
I'm playing around with CI around PHP CLI.
I'm now able to access the whole CI structure via a Global variable $CI (followed the tutorial here http://codeigniter.com/wiki/dip_into_CI/)
$CI = new $class();
$CI -> load->view ('header');
Now works good, but I don't know how to access a controller thru the $CI variable.
Let's say I have a controller called main(); i'd like to be able to do something like :
$CI->main->myfunction($params);
Must be real simple but can't figure out
Upvotes: 2
Views: 3089
Reputation: 317
Yes.. It works with MX and the "regular" CI that you download from codeigniter.com.
Upvotes: 0
Reputation: 30766
That's all possible but a little crazy. Just use CodeIgniter Reactor. Controllers can respond to command line perfectly.
https://bitbucket.org/ellislab/codeigniter-reactor
php index.php controller method param1 param2
Works with routing and everything.
Upvotes: 3