EllisLab text mark
Advanced Search
     
CI instance in external class
Posted: 18 July 2010 08:12 PM
Joined: 2010-07-03
12 posts

Hi guys, is it possible to load CodeIgniter object (get_instance() in libraries/helpers) in external php class.
For some reasons, i can’t make library/helper out of one php class, but i need some variables from Framework in this class (no, i can’t send variables there - this class is loaded before CI).

Thanks.

 
Posted: 18 July 2010 11:16 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-10-18
334 posts

try this:

ob_start();
include(
'index.php');
ob_end_clean();
$CI =& get_instance(); 
 Signature 

Wallpapers and Images Site: Desktop Wallpapers

 
Posted: 19 July 2010 06:25 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2010-07-03
12 posts

Thanks a lot, Buso. That code works, unfortunately, i decided to rework class to integrate it with CI without includes. Anyway, i hope some people will find it helpful.
Thanks again.