• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Loading xenforo in a php page, page looses formating?

#1
Hello,

I am trying to integrate the acounts (and threads) of the forum on a php website made completely independent of it. After searching a bit on the internet it seems that is not hard to get the information considering that Xenforo is initialized.

Ok, so, for initializing (and example) I found this:

Code:
        define('XF_ROOT', 'C:/wamp/www/xenforo'); 
        $userinfo = null;
        require_once(XF_ROOT . '/library/XenForo/Autoloader.php');

        XenForo_Autoloader::getInstance()->setupAutoloader(XF_ROOT. '/library');
       
        XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT); 
           
        XenForo_Session::startPublicSession();
        $visitor = XenForo_Visitor::getInstance();

        if ($visitor->getUserId()){
            $userModel = XenForo_Model::create('XenForo_Model_User');
            $userinfo = $userModel->getFullUserById($visitor->getUserId());
        }
But when I do this, the page is completely screwed up. If I just have the code untill the setupAutoloader, I get this as expected:



However, if I simply add the initialize, this is what happens:



There are no php errors, and if I add all the code above, the call to $userinfo is working correctly.

Does anyone why do the page gets like this?
 
#2
ok, so, I found that the error comes from here:

Code:
if (!@ini_get('output_handler'))
            {
                $level = ob_get_level();
                while ($level)
                {
                    @ob_end_clean();
                    $newLevel = ob_get_level();
                    if ($newLevel >= $level)
                    {
                        break;
                    }
                    $level = $newLevel;
                }
            }
which is on beginApplication on Application php. If I comment this block both the forum and site seem to work fine. Does anyone know what is happening? Any reason for me not to do this?