+1  A: 

Create a custom __autoload function. Rename the CI original into __autoload_ci and the Flourish __autoload_flourish.

It's important to add a return true; to both original autoloaders, when they were successful. Remove any errors/exceptions. Then deploy a custom wrapper:

 function __autoload($class) {
     __autoload_ci($class) || __autoload_flourish($class);
 }

Or use spl_autoload_register

mario
Thanks for the quick response, Mario! But I am not very clear about how to implement this, because I am also new to Codeigniter as well. I can easily update the flourish autoload function and set this new custom wrapper to run by default (thus include both autoloaders). But when I searched for the autoload function in CI, all I find is a set of arrays. Please can you give any pointers?
Ticabo
And I'm also wondering how I ought to do this by extending CI rather than editing its core system files... Thanks.
Ticabo
Seems CI only has ./system/libraries/Loader.php and does not actually use PHPs __autoload feature. I guess it autoloads on attribute/subobject access. So, no idea what to do.
mario
Thanks again. Do you think spl_autoload can help in this case?
Ticabo
It basically provides an autoloader chain. If your problem lies in a class conflict, it won't help. But give it a try and spt_autoload_register("__autoload_flourish"); Else you need to hack CIs Autoload class, which I don't have the slightest idea how to do.
mario
No its not a class conflict, as far as I see. The problem is that the native autoload function can only be carried out ONCE. But im not clear how CI does its own autoloading, since its not the native way :( Thanks a lot for your help, Mario.
Ticabo
That's what I read about CodeIgniter. Its main object handles instantiation of all the required subobjects. A clever approach actually. But I can't see through how they do it.
mario
Do you think I can possible add flourish to the required subobjects then?
Ticabo
+1  A: 

I'm the author of Flourish. The example autoloader I provide on the getting started page is just supposed to help people get up and started if they don't have an environment already.

In your case since you have multiple libraries, I would recommend using spl_autoload_register(). You can register the CI autoloader and then register your Flourish one.

wbond
Thank you very much, wbond. Im grateful! I will go to the CI forums for further enquiry on the CI autoloader. Maybe I will return to post my answer when I get it working fine.
Ticabo
A: 

Thanks to http://codeigniter.com/forums/viewthread/73804/#366081 and some bits of information from some CI folk that I follow on twitter (I asked em): Eric Barnes, Dan Horrigan, Phil Sturgeon and Zack Kitzmiller, I found a solution. If you are a CodeIgniter n00b like me, you may like to follow these guys.

I deleted init.php and config.php, then jammed the following into the bottom of my CI's config.php (I am also autoloading from a custom library called mylibrary).

function multi_auto_require($class) {
if(stripos($class, 'CI') === FALSE && stripos($class, 'PEAR') === FALSE) {
    foreach (array('flourish', 'mylibrary') as $folder){
        if (is_file(APPPATH."../auxengines/{$folder}/{$class}.php")){
            include_once APPPATH."../auxengines/{$folder}/{$class}.php";
        }
    }
}
}

spl_autoload_register('multi_auto_require');

Works brilliantly. Thanks, people!

Ticabo