Hi
I would like to minify all my html at render time. I've managed to do it for the header, footer and my forms. But any content that's in layout ss files I can't reach.
I've tried to create a method "layout" in my Page_Controller but it has sporadic results. Sometimes it returns a blank page, sometimes it gets in an infinite loop.
public function layout()
{
$arrLayouts = array(
str_replace( "_Controller", "", get_class( $this ) ),
'Page'
);
return $this->minifyOutput( $this->renderWith( $arrLayouts ) );
}
I have a super simple function in my Page_Controller that I want to run the html through
function minifyOutput($buffer)
{
$search = array(
'/\>[^\S ]+/s',
'/[^\S ]+\</s',
'/(\s)+/s'
);
$replace = array(
'>',
'<',
'\\1'
);
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
All I'd like to do is minify my pages. Am I looking in the wrong place? Is it even possible to override layout successfully?
Thank