This script worked on one server, but started choking after I moved it to a new server.

Summary: I use the php_auto_prepend script to start output buffering, then use the php_auto_append script to extract the content between the title tags and between the body tags. When the size of the content between the body tags reaches around 11,500 characters, the ereg function stops working correctly.

What governs the number of characters that ereg can process?

I looked at the phpinfo from both servers but didn't find any clues...

Thanks for the help :)


FYI sample code:


prepend--

<?php

ob_start();

?>


append--


<?php

// load document into $file_text

$file_text = ob_get_contents();
ob_end_clean();

// extract title

unset($regs);

// use preg_match because its supposed to be faster...
//eregi("<title>(.*)</title>",$file_text,$regs);

preg_match("|<title>(.*)</title>|i",$file_text,$regs);

$document_title = $regs[1];

// extract body of document (need to add onload statement in <body> tag)

unset($regs);

// I don't have the foggiest why preg_match doesn't seem to work here...
//preg_match("|\<body(.*)</body>$|i",$file_text,$regs);
//preg_match("|>(.*)|i",$regs[1],$temp);

eregi("<body(.*)</body>",$file_text,$regs);
ereg(">(.*)",$regs[1],$temp);
$template_body = $temp[1];

// stuff $document_title and $document_body into the "official" template

/* snip */
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to