note 109837 added to function.ob-end-flush
| From: | (at) | Date: | Sun, 26 Aug 2012 16:24:39 +0000 |
| Subject: | note 109837 added to function.ob-end-flush | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190222@lists.php.net to get a copy of this message | ||
best way to compress a css code:
<?php
header('Content-type: text/css');
ob_start("compress");
function compress($buffer) {
// remove comments
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
// remove tabs, spaces, newlines, etc.
$buffer = str_replace(array("\r\n", "\r", "\n", "\t",
' ', ' ', ' '), '', $buffer);
return $buffer;
}
include('./template/main.css');
include('./template/classes.css');
<?php
ob_end_flush();
?>
Include in <head>:
<link rel="stylesheet" type="text/css" href="/design.php"
media="all" />
----
Server IP: 69.147.83.197
Probable Submitter: 95.33.50.177
----
Manual Page -- http://www.php.net/manual/en/function.ob-end-flush.php
Edit -- https://master.php.net/note/edit/109837
Del: integrated -- https://master.php.net/note/delete/109837/integrated
Del: useless -- https://master.php.net/note/delete/109837/useless
Del: bad code -- https://master.php.net/note/delete/109837/bad+code
Del: spam -- https://master.php.net/note/delete/109837/spam
Del: non-english -- https://master.php.net/note/delete/109837/non-english
Del: in docs -- https://master.php.net/note/delete/109837/in+docs
Del: other reasons-- https://master.php.net/note/delete/109837
Reject -- https://master.php.net/note/reject/109837
Search -- https://master.php.net/manage/user-notes.php