Chris Shiflett wrote:
Mathijs wrote:

How can i add more callback_outputs to ob_start?

I want to have both: ob_start('switchContent');
and: ob_start('ob_gzhandler');


I don't think you can, but you could have a single function that calls both, then specify that function in ob_start().

I think you can by simply stacking multiple output buffers on top
of each other:

ob_start('switchContent'); // first buffer, for first callback
ob_start('ob_gzhandler');  // second buffer, for second callback        

take care to define the handlers in the 'right' order
(the order that they are run in may be important to your output/code)

// rest of code.

I implemented a class once that stacks a list of callbacks
which could then all be run by its callback handler, psuedo-code:

class CB
{
        private static $cbs = array();

        public static function addCB($cb)
        {
                if (is_callable($cb)) {
                        self::$cbs[] = $cb;
                }
        }

        public static function run($data)
        {
                foreach (self::$cbs as $cb) {
                        $data = call_user_func($cb, $data);
                }

                return $data;
        }
}

ob_start( array('CB','run') );


Chris


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

Reply via email to