Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Problems with Autoloader...can anyone help please?

Hi all, i'm having a nightmare with the Gdn Autoloader. The problem is that I am running Vanilla alongside our existing app which is based on Zend Framework (v1) and which registered its own autoloader.

If I push Gdn_Autoloader::Lookup onto the Zend Autoloader stack, then it allows me to call Gdn classes directly from within the Zend app.

However, when I try to include the Gdn framework (for things like logging users in/out) then I get errors such as...

include_once(MenuModule.php): failed to open stream: No such file or directory

This has something to do with both autoloaders co-existing, because if I de-register the Zend autoloader before including the Gdn framework then all works as expected, but then the Zend app fails to work...

BTW i'm including the Gdn framework like so...

        define('APPLICATION', 'Vanilla');
        define('APPLICATION_VERSION', '2.1.9');
        define('PATH_ROOT', PUBLIC_PATH.'/community');

        ob_start(); // Buffer the output of the code below.
        require_once(PATH_ROOT . '/bootstrap.php'); // Require the bootstrap for the framework used by Vanilla.
        $Dispatcher = Gdn::Dispatcher(); // Declare an alias for the dispatcher.
        // Set up the dispatcher.
        $EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders();
        $Dispatcher->PassProperty('EnabledApplications', $EnabledApplications);
        // Mimic the DiscussionsController().
        $Controller = new DiscussionsController();
        ob_end_flush(); // Stop and send the buffer for the code above.

Most Gdn classes seem to load ok, but the MenuModule.php and similar classes don't.

Any ideas? Thanks.


Sign In or Register to comment.