Surely better to move the GZIP, header, and the various template generation stuff to somewhere before $template->display('body'); in page_tail.php? It would work fine without any changes to other code.
Not a big thing, but it would cut your number of includes by one on each page. Maybe a little more speed, and a bit more neatness