Re: output buffering callback limitation
| From: | Taco van den Broek | Date: | Thu, 10 Jun 2004 07:50:57 +0000 |
| Subject: | Re: output buffering callback limitation | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10368@lists.php.net to get a copy of this message | ||
Okin okin wrote:
Hi, I'm having trouble with output buffering limitation and the output_callback function of ob_start. look at this script : <?php function ob_perso_handler($buffer) { ob_start(); echo 'foo'; $buffer .= ob_get_contents(); ob_end_clean(); return $buffer; } ob_start('ob_perso_handler'); echo 'Hello World !'; ?> it outputs : "Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers" Why then ? It would be a killer feature for my next killer appz ! I've tried also : <?php function ob_perso_handler1($buffer) { return $buffer . 'f1'; } function ob_perso_handler2($buffer) { ?> foo <? return $buffer . 'f2'; } ob_start('ob_perso_handler1'); ob_start('ob_perso_handler2'); echo 'Hello World !'; ?> but were does "foo" go ? any idea on that ? maybe some source change to PHP to permit one or the other solution ? I'm new to this mailing list, please redirect me to the correct one if I'm wrong here. My thought was it was a developper problem, since change to the source has to be done to enable such this feature ... Many thank's for any help ! Nikos Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com I don't really understand your problem, it seams to me you want to add output to the buffer in the output handler!?Why not just: <?php function myObHandler($buffer) { $buffer .= 'foo'; return $buffer; } ob_start('myObHandler'); ?> -Taco