SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why does this not work?

    Ok I am trying to use output buffering in templates to hide data instead of using echo with heredocs or quotes or any other form.

    For somereason the output buffer is empty, heres an example

    PHP Code:
    <?ob_start();?>
        <?=WC_VERSION?>
        <br />
    <?
    if ($Authentication->WebAuthenticate()) {
        echo 
    ob_get_contents();
    }
    ob_end_clean();

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PotatoBob
    if ($Authentication->WebAuthenticate()) {
    Are you sure this condition is passing?

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i can think of 2 possibilities.

    1) view your html source, and you will see the <br />. WC_VERSION could be an empty value.
    2) $Authentication->WebAuthenticate() returns false, which causes your output of the buffer to fail.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1:those are filled
    2: yes it returns true

  5. #5
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AH!

    you are echo'ing back into the output buffer, and then destroying the buffer with ob_end_clean(); store the buffer into a variable for output after buffering is stopped.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow silly me
    thanks man, I did not even catch that and I spent so much time wondering why this didnt work


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
  •