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 here. These earlier versions are no longer being updated and have security issues.

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->EnabledApplicationFolders($EnabledApplications);
        $Dispatcher->PassProperty('EnabledApplications', $EnabledApplications);
        // Mimic the DiscussionsController().
        $Controller = new DiscussionsController();
        Gdn::Controller($Controller);
        Gdn::Request()->WebRoot('');
        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.

Comments

  • Force loading frameworks is rarely a good solution. What are you trying to do?

    grep is your friend.

  • @x00 said:
    Force loading frameworks is rarely a good solution. What are you trying to do?

    Basically just sign a user into, and out of, the forum when they sign into our main app. I've already looked at the jsConnect plugin but that didn't seem to fit our needs.

  • hgtonighthgtonight ∞ · New Moderator

    jsConnect would be the "appropriate" way to manage this.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.