Minify html output

Hello all,

i’m trying to minify the html output but no success, i use phpvms v2.

example:

\<!DOCTYPE HTML\> \<html lang="pt-PT"\> \<head\> \<meta charset="utf-8"\> ...

 

to be

\<!DOCTYPE HTML\>\<html lang="pt-PT"\>\<head\>\<meta charset="utf-8"\>...

 

I´m trying to use this code on top of layout.tpl

function sanitize\_output($buffer) { $search = array( '/\\>[^\S]+/s',// strip whitespaces after tags, except space '/[^\S]+\\</s',// strip whitespaces before tags, except space '/(\s)+/s',// shorten multiple whitespace sequences '/\<!--(.|\s)\*?--\>/' // Remove HTML comments ); $replace = array( '\>', '\<', '\\1', '' ); $buffer = preg\_replace($search, $replace, $buffer); return $buffer; } ob\_start("sanitize\_output");

when i see the source code nothing change, someone know how to do it?

Thank you