im doing a little research regarding html minimization from php. as
class themeing
{
function render( $file, $folder )
{
if ( COMPRESS ) {
ob_start('compressor');
}
$get = VIEWS . $folder . '/' . $file . '.phtml';
if ( COMPRESS ) {
ob_end_flush();
}
return $get;
}
function compressor($buffer)
{
$search = array(
'/<!--(.|\s)*?-->/',
'/\>[^\S ]+/s',
'/[^\S ]+\</s',
'/(\s)+/s'
);
$replace = array(
'',
'>',
'<',
'\\1'
);
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
}
The problem is, what do I call it ob_start (function)? can we do ob_start ($ this-> compresssor ())? (ok, i know this is not) inside the class? is anyone
Thanks for watching.
Adam Ramadhan
source
share