Jump to content

[SOLVED] output buffering - bufferes include data bu not initial data


PC Nerd

Recommended Posts

Hi,

 

Code:

<?php
$OUTPUT = array();
$PAGE_LEVEL = 1;
$_USER['doc_root'] = '../';

ob_start();

###
### Main page output, start template buffering
###

echo "Content part 1<br>";
echo "Content part 2<br>";
echo "Content part 2<br>";

$OUTOUT['CONTENT'] = ob_get_contents();
#$OUTPUT['CONTENT'] = "TESTING!!!";
#ob_get_flush();
ob_clean();

#ob_start();
require("../themes/template.php");
$OUTPUT['template'] = ob_get_contents();
ob_clean();
#ob_start();
require("../pre/crumbs.php");
$OUTPUT['CRUMBS'] = ob_get_contents();
ob_clean();

#echo $OUTPUT['template']."<br>";
#echo $OUTPUT['CRUMBS']."<br>";

$OUT = "";
#$OUT .= $OUTPUT['CRUMBS'];
#$OUT .= "<br>".$OUTPUT['template'];
$OUT .= "<br>".$OUTPUT['CONTENT'];

/*
#$OUT .= str_replace("[%CONTENT%]", $OUTPUT['CONTENT'], $OUTPUT['template']);
#$OUT .= str_replace("[%CRUMBS%]", $OUTPUT['CRUMBS'], $OUTPUT['template']);
*/

echo $OUT;
?>


$OUTPUT['CONTENT'] isnt set - and doesnt display.  eventually( as you can see from the commented out areas), Ill bs using the include files to replace content in a templat.... hence $OUTPUT['template']

Am I using the wrong function, or is there somethign else ive missed?

thanks

but if ive stored the output as a variable as i have done.. ( in the array)... it shouldnt really care whether its output to "echo" or otput to storage.

 

* Ive tried a range of functions:

 

ob_get_flush(); to get the contents, and that way i didnt have to clear the buffer and all sort of things.

 

also - i tried commenting out all of the ob_clean();'s, and placed a single one after the echo $OUT; but it made no difference.

 

Any other suggestions?

 

Thanks

When you first assign something to $OUTPUT['CONTENT'] you've miss-spelt it. You have the following...

 

$OUTOUT['CONTENT'] = ob_get_contents();

 

When it should be...

 

$OUTPUT['CONTENT'] = ob_get_contents();

 

Also, just a thought, but upper case variables names look horrible.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.