I’ve recently reviewed COutputProcessor and COutputEvent, but I’m still confused about how to add a new handler to these classes.

I’m about to implement gzipping; so far, attaching a behavior seems the best approach. Correct?

COutputProcessor is mainly used as a base class. For an example, see CHtmlPurifier.

Can I combine multiple processors?

What do you mean by combining multiple processors?

Maybe I want to transform some input with Markdown processor (talking about theory), then I want to gzip the whole page with another one.

You can nest the widgets. for example, the inner-most widget is a markdown processor, and the enclosing widget is your gzip widget.

I went with application events, seemed much easier.


Very smart usage of create_function!

Thanks! :) Most developers wouldn’t think that lambda functions will ever be handy.