User Profile

Collapse

Profile Sidebar

Collapse
Cractuar
Cractuar
Last Activity: Jan 25 '08, 08:45 PM
Joined: Nov 16 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Cractuar
    replied to echo as streambuffer
    in PHP
    Okay I've found this:

    [PHP]
    // Enable output buffering
    ob_start();

    echo date("Y-m-d");

    // get the buffer, clear it & return to template
    return ob_get_clean();
    [/PHP]

    but is there a better way?
    See more | Go to post
    Last edited by Cractuar; Jan 19 '08, 05:39 PM. Reason: found a even better way

    Leave a comment:


  • Cractuar
    started a topic echo as streambuffer
    in PHP

    echo as streambuffer

    This is what I want to accomplish:

    In index.php:
    [code=php]
    $var = include(“conten t.php”);
    echo $var;
    [/code]
    In content.php:
    [code=php]
    $outputStream = date("Y-m-d"); //some dynamic text
    return $outputStream;
    [/code]

    but without needing the variable $outputStream, instead I want to be able to write "echo date("Y-m-d");" in content.php....
    See more | Go to post
    Last edited by Atli; Jan 19 '08, 10:31 PM. Reason: Added [code] tags.
No activity results to display
Show More
Working...