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

Everything Disappears from My Web Page When

Discussion in 'XenForo Development Discussions' started by Dan Allen, Jul 8, 2016.

  1. Dan Allen

    Dan Allen Active Member

    This is not a problem or malfunction, but a question about system behavior and potential impact on integration.

    When connecting to XenForo from an external app, there are certain steps that blow away whatever a browser has started to collect as a response from a url that connects to XenForo. An example is this statement, which is used in index.php and admin.php:

    $fc = new XenForo_FrontController(new XenForo_Dependencies_Public());
    Well, admin.php has "Admin" in the positions that say "Public" in index.php

    I am sure there are others and I have not seen a case where using XenForo from a remote app does not trigger this effect. I have started making a habit of always calling to connect to XF at the start of any program that is going to be needing to work with XF. It has not been a problem so far but I am wondering what exactly is causing this behavior and whether there is a way to get work done without it happening. I can imagine scenarios where another app would do the same thing and if both that app and XF are needed by an app I am running I wonder if there is potential for irresolvable conflict, where both systems have to blow something away the other needs.
  2. Mike

    Mike XenForo Developer Staff Member

    I'm not sure what situation you'd have where you'd want to be integrating XF but instantiating/running the front controller. That's for a full page view and will thus be outputting full headers, a full page with gzip, etc. You would need to call lower level methods (like model level things).

    But beyond that, look at the initialization configuration you can manipulate when XenForo_Application::initialize() is called. You probably want to not reset the output buffers.
  3. Dan Allen

    Dan Allen Active Member

    Well the sending of headers is definitely what I am talking about. By stepping through the,FrontController
    I have seen the headers going out being the exact thing triggering what I am taking about. I appreciate the suggestion of looking at how XenForo_Application::initialize() is manipulated. That is going to help with a lot of things I bet.

    I don't know how much XenForo_Application::initialize() figures into routing, dispatching, predispatching, etc, those areas are happening and I haven't figured out how to know which objects are getting involved.

    99% of the programs I write or work with don't anything in them for headers, except, I guess default headers taken care of by the server.
  4. Mike

    Mike XenForo Developer Staff Member

    That's part of what I mean about the front controller being for full responses: it does routing, it outputs the entire page, it gzips the output, it outputs headers. (Though note that starting a session sends headers too.) If you're trying to integrate into another page, you likely want to work at a lower level.

    That said, note that you can control the front controller to tell it to return the response content instead of outputting.

Share This Page