Tim Blair

Modifying Page Generated Content (15/03/2004)

A post on MossyBlog was f-ing and blinding about whitespace appearing where it wasn't at all welcome. I've had the same issue before so I thought why not just see if there's a way to trim everything down before sending to the browser? As you generate content through your page, the data must be stored somewhere, so how to get at it?

The answer: using the good old underlying java of CF (therefore there are no guarantees with this!). By accessing the output buffer you can get a copy of the information stored in it, clear it, modify the content somehow (replacing variables, getting rid of white space etc) and then simply send it back to the output buffer with <cfoutput>...

Have a look at this to see what I mean:

Article Archive (September '03 – '05)