PC Nerd Posted June 29, 2008 Share Posted June 29, 2008 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 Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/ Share on other sites More sharing options...
papaface Posted June 29, 2008 Share Posted June 29, 2008 ob_clean();[code] I don't think you're supposed to put that in until after [code]echo $OUT; But I may be wrong.[/code][/code] Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/#findComment-577167 Share on other sites More sharing options...
PC Nerd Posted June 29, 2008 Author Share Posted June 29, 2008 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 Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/#findComment-577177 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 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. Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/#findComment-577196 Share on other sites More sharing options...
PC Nerd Posted June 29, 2008 Author Share Posted June 29, 2008 ahhh - of course.. Thanks Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/#findComment-577203 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 No worries! If this is solved now please click the 'Topic Solved' link at the bottom left of the screen! Thanks Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/#findComment-577214 Share on other sites More sharing options...
PC Nerd Posted June 29, 2008 Author Share Posted June 29, 2008 yup - i usually do.. forgot this time ( been a whie since i was on here regularly) Thankyou! Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/#findComment-577233 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 No worries friend! Link to comment https://forums.phpfreaks.com/topic/112426-solved-output-buffering-bufferes-include-data-bu-not-initial-data/#findComment-577235 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.