piuozorio Posted May 26, 2020 Report Share Posted May 26, 2020 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.