SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    May 2003
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CMS not outputting all the html (could be a buffering problem- ob_start())

    I have a custom framework for a client. When the webpage making use of the framework is rendered, only the header/top content shows.

    This is psuedocode for how it works on a basic page.
    PHP Code:
    ob_start();//I read that this could solve my problem
    /* 
     *this function echo's and includes HTML head,meta and other 
     *content just afterthe <body> tag
     */
    CMS->getHeader(); 

    /*
     *this function echo's some content based on an action.
     */
    CMS->processAction($_GET['someAction']); 
    /*
     *this function closes the main content wrapper and 
     *the <body>, <html> tags
     */
    CMS->getFooter(); 
    I thought that ob_start(); would help, but apparently, I'm wrong.

    How can I solve this? place all content in a variable, then output it? Alot of code to change! (~shudder~)
    Last edited by tinonetic; Jul 8, 2009 at 07:35.
    Elgg Customisation & Theme development
    Modx Custom Development
    PHP programming

  2. #2
    <?php while(!sleep()){code();} G.Schuster's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ob_end_flush() anywhere?
    Read the docs before using anything "you've read somewhere"...

  3. #3
    PHP Guru lampcms.com's Avatar
    Join Date
    Jan 2009
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    using output buffering is not the ideal way to create a web page.
    also if you use ob_start() to capture the content then you must have a function to get the content from the buffer

    after the CMS->getFooter()
    add this:
    $content = ob_get_clean();
    echo $content;

  4. #4
    SitePoint Zealot
    Join Date
    May 2003
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by G.Schuster View Post
    ob_end_flush() anywhere?
    Read the docs before using anything "you've read somewhere"...
    forgot to include it in my example, but i did use it.

    had actually read from the online manual
    Elgg Customisation & Theme development
    Modx Custom Development
    PHP programming

  5. #5
    SitePoint Zealot
    Join Date
    May 2003
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Sharedlog.com View Post
    using output buffering is not the ideal way to create a web page.
    also if you use ob_start() to capture the content then you must have a function to get the content from the buffer

    after the CMS->getFooter()
    add this:
    $content = ob_get_clean();
    echo $content;
    thanks for the advice, will try it out
    Elgg Customisation & Theme development
    Modx Custom Development
    PHP programming


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •