Basdub Posted May 16, 2007 Share Posted May 16, 2007 Newbie - Sorry if stupid question. I have a class that produce an html table to display MySql table records. Added to that, it display a Navigation system (previous next ...). The way the class id built, it echo the html as it produces it. what i would like to modify, is to echo a temporary tag like <Mystuff:nav> somewhere along the way. then generate the navigation html code and store it in memory. now when the html table is completely echoed, iwould like to replace the <Mystuff:nav> by the navigation html code stored in memory previously. Would that be possible. Oh! Could I replace text in the response buffer which would already contain the echoed html? Any idea Link to comment https://forums.phpfreaks.com/topic/51675-solved-replace-echoed-text/ Share on other sites More sharing options...
trq Posted May 16, 2007 Share Posted May 16, 2007 You could catch all the output in the buffer and place it in a string, modify the string however you please and then output that. eg; <?php ob_start(); echo "This is a test"; $out = ob_get_contents(); ob_end_clean(); echo str_replace('test','foo',$out) ?> Link to comment https://forums.phpfreaks.com/topic/51675-solved-replace-echoed-text/#findComment-254587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.