0

My client's server doesn't support php and requires alot of updates so I had the page export a .html. Now he wants to export part of this page so he can upload it somewhere else.

How do i call two ob_start();, i know its possible but how do i distinquish between the two?

Sample page sudo code

ob_start();  //1 obstart  

<html>
<head></head>
<body>
ob_start();   //2 obstart  
<div class="special"></div>
//stop copying obstart #2
</body>
</html>


$contentString =  ob_get_contents();
$divString =  ob_get_contents();

file_put_contents( 'HTMLFile.html', $contentString ); 
file_put_contents( 'specialDIV.txt', $divString ); 
artSir
  • 540
  • 1
  • 8
  • 29

1 Answers1

0
<?php
ob_start();  //1 obstart  
?>
<html>
<head></head>
<body>
<?php
$contentString =  ob_get_contents();
ob_start();   //2 obstart 
?> 
<div class="special"></div>
//stop copying obstart #2
</body>
</html>

<?php
$divString =  ob_get_contents();

file_put_contents( 'HTMLFile.html', $contentString ); 
file_put_contents( 'specialDIV.txt', $divString ); 
?>
xdazz
  • 158,678
  • 38
  • 247
  • 274
  • What i ended up doing is dividing the page into 3 parts $pagePart1 = ob_get_contents(); ob_flush(); $pagePart2 = ob_get_contents(); ob_flush(); $pagePart3 = ob_get_contents(); ob_flush(); Then i did file put contents combining all three parts And another just file put content on part2 for the center part wondering if there is a smarter way – artSir Oct 17 '13 at 14:03