Wednesday, June 11, 2014

Re: Delete white spaces in content

could you tell how to get all the content to engage my function in renderLayout?
$layoutFile - return path to layout file.

среда, 11 июня 2014 г., 14:56:42 UTC+4 пользователь euromark написал:
You can use a helper and the http://book.cakephp.org/2.0/en/views/helpers.html#Helper::afterLayout callback to do that.


Am Dienstag, 10. Juni 2014 14:16:08 UTC+2 schrieb Сергей Калистратов:
I want to compress the output of the entire HTML code
I have simple function

public 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
    );
    $replace = array(
        '>',
        '<',
        '\\1'
    );
    $buffer = preg_replace($search, $replace, $buffer);
    return $buffer;
}

I found that the output of all content located in renderLayout.

How can I override and before displaying content use my function? Or is there still what that means for compression of the whole page? 

Thank you very much!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: