<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Compress Your XHTML Page Output Using PHP Output&#160;Buffers</title> <atom:link href="http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Thu, 09 Feb 2012 15:40:33 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>By: Jody</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-27254</link> <dc:creator>Jody</dc:creator> <pubDate>Fri, 14 Oct 2011 23:43:46 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-27254</guid> <description>[code]
ob_start();
// INIT AND START THE APPLICATION
include_once(&quot;includes&quot; . DS . &quot;init.inc.php&quot;);
$sContent	= ob_get_contents();
ob_clean();$content = str_replace(array(&quot;\n&quot;, &quot;\r&quot;, &quot;\t&quot;, &quot;\o&quot;, &quot;\xOB&quot;), &#039;&#039;, $sContent);
[/code]</description> <content:encoded><![CDATA[<p>[code]<br
/> ob_start();<br
/> // INIT AND START THE APPLICATION<br
/> include_once("includes" . DS . "init.inc.php");<br
/> $sContent	= ob_get_contents();<br
/> ob_clean();</p><p>$content = str_replace(array("\n", "\r", "\t", "\o", "\xOB"), '', $sContent);<br
/> [/code]</p> ]]></content:encoded> </item> <item><title>By: Gia ca phe</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-23579</link> <dc:creator>Gia ca phe</dc:creator> <pubDate>Fri, 15 Apr 2011 17:31:48 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-23579</guid> <description>tks
It&#039;s very helpful for me</description> <content:encoded><![CDATA[<p>tks<br
/> It&#8217;s very helpful for me</p> ]]></content:encoded> </item> <item><title>By: Uzo</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-20847</link> <dc:creator>Uzo</dc:creator> <pubDate>Thu, 30 Sep 2010 16:50:43 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-20847</guid> <description>Oh this piece of code has been godsend to me. Extremely easy to set up and very noticable rewards even on an empty cache. Thanks!</description> <content:encoded><![CDATA[<p>Oh this piece of code has been godsend to me. Extremely easy to set up and very noticable rewards even on an empty cache. Thanks!</p> ]]></content:encoded> </item> <item><title>By: Sair Ecashbot</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-11172</link> <dc:creator>Sair Ecashbot</dc:creator> <pubDate>Mon, 10 Aug 2009 18:29:32 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-11172</guid> <description>Really cool feature</description> <content:encoded><![CDATA[<p>Really cool feature</p> ]]></content:encoded> </item> <item><title>By: Shaun</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-11133</link> <dc:creator>Shaun</dc:creator> <pubDate>Sat, 08 Aug 2009 10:01:30 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-11133</guid> <description>I rewrote the algorithm as My solution was incomplete (remove comments, tabs, spaces, newlines, etc):compress&#095;page($buffer) {
$search = array(
&quot;/ +/&quot; =&gt; &quot; &quot;,
&quot;/&lt;!--\{(.*?)\}--&gt;&#124;&lt;!--(.*?)--&gt;&#124;[\t\r\n]&#124;&lt;!--&#124;--&gt;&#124;\/\/ &lt;!--&#124;\/\/ --&gt;&#124;&lt;!\[CDATA\[&#124;\/\/ \]\]&gt;&#124;\]\]&gt;&#124;\/\/\]\]&gt;&#124;\/\/&lt;!\[CDATA\[/&quot; =&gt; &quot;&quot;
);
$buffer = preg&#095;replace(array&#095;keys($search), array&#095;values($search), $buffer);
return $buffer;}this compresses all html, and javaScript but not CSS for this I use:compress&#095;styles($buffer) {
// remove comments, tabs, spaces, newlines, etc.
$search = array(
&quot;/\/\*(.*?)\*\/&#124;[\t\r\n]/s&quot; =&gt; &quot;&quot;,
&quot;/ +\{ +&#124;\{ +&#124; +\{/&quot; =&gt; &quot;{&quot;,
&quot;/ +\} +&#124;\} +&#124; +\}/&quot; =&gt; &quot;}&quot;,
&quot;/ +: +&#124;: +&#124; +:/&quot; =&gt; &quot;:&quot;,
&quot;/ +; +&#124;; +&#124; +;/&quot; =&gt; &quot;;&quot;,
&quot;/ +, +&#124;, +&#124; +,/&quot; =&gt; &quot;,&quot;
);
$buffer = preg&#095;replace(array&#095;keys($search), array&#095;values($search), $buffer);
return $buffer;}Hope this is useful to someone.</description> <content:encoded><![CDATA[<p>I rewrote the algorithm as My solution was incomplete (remove comments, tabs, spaces, newlines, etc):</p><p>compress&#95;page($buffer) {<br
/> $search = array(<br
/> &#8220;/ +/&#8221; =&gt; &#8221; &#8220;,<br
/> &#8220;/&lt;!&#8211;\{(.*?)\}&#8211;&gt;|&lt;!&#8211;(.*?)&#8211;&gt;|[\t\r\n]|&lt;!&#8211;|&#8211;&gt;|\/\/ &lt;!&#8211;|\/\/ &#8211;&gt;|&lt;!\[CDATA\[|\/\/ \]\]&gt;|\]\]&gt;|\/\/\]\]&gt;|\/\/&lt;!\[CDATA\[/" =&gt; ""<br
/> );<br
/> $buffer = preg&#95;replace(array&#95;keys($search), array&#95;values($search), $buffer);<br
/> return $buffer;</p><p>}</p><p>this compresses all html, and javaScript but not CSS for this I use:</p><p>compress&#95;styles($buffer) {<br
/> // remove comments, tabs, spaces, newlines, etc.<br
/> $search = array(<br
/> "/\/\*(.*?)\*\/|[\t\r\n]/s&#8221; =&gt; &#8220;&#8221;,<br
/> &#8220;/ +\{ +|\{ +| +\{/&#8221; =&gt; &#8220;{&#8220;,<br
/> &#8220;/ +\} +|\} +| +\}/&#8221; =&gt; &#8220;}&#8221;,<br
/> &#8220;/ +: +|: +| +:/&#8221; =&gt; &#8220;:&#8221;,<br
/> &#8220;/ +; +|; +| +;/&#8221; =&gt; &#8220;;&#8221;,<br
/> &#8220;/ +, +|, +| +,/&#8221; =&gt; &#8220;,&#8221;<br
/> );<br
/> $buffer = preg&#95;replace(array&#95;keys($search), array&#95;values($search), $buffer);<br
/> return $buffer;</p><p>}</p><p>Hope this is useful to someone.</p> ]]></content:encoded> </item> <item><title>By: Davin Bergstrom</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-11096</link> <dc:creator>Davin Bergstrom</dc:creator> <pubDate>Fri, 07 Aug 2009 16:09:25 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-11096</guid> <description>@Shaun: same problem, you solution worked.</description> <content:encoded><![CDATA[<p>@Shaun: same problem, you solution worked.</p> ]]></content:encoded> </item> <item><title>By: Nolochemical</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-10323</link> <dc:creator>Nolochemical</dc:creator> <pubDate>Sat, 11 Jul 2009 02:28:45 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-10323</guid> <description>Neat! Very effective, perfect for inline documentation.</description> <content:encoded><![CDATA[<p>Neat! Very effective, perfect for inline documentation.</p> ]]></content:encoded> </item> <item><title>By: Louis</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-7932</link> <dc:creator>Louis</dc:creator> <pubDate>Thu, 26 Feb 2009 23:13:17 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-7932</guid> <description>@Nouman: what is &quot;way further&quot; exactly? If it&#039;s just the removal of the newlines, I don&#039;t believe that it will be enough to say that the same conclusion as the study I pointed to doesn&#039;t apply here.The removal of human-dedicated characters is not interesting when digging out to optimize performances because (a) there&#039;s too little to win for normal size webpages, and (b) the gzip compression make advantage of the redundance of these special characters and thus compress the page effisciently enough.</description> <content:encoded><![CDATA[<p>@Nouman: what is &#8220;way further&#8221; exactly? If it&#8217;s just the removal of the newlines, I don&#8217;t believe that it will be enough to say that the same conclusion as the study I pointed to doesn&#8217;t apply here.</p><p>The removal of human-dedicated characters is not interesting when digging out to optimize performances because (a) there&#8217;s too little to win for normal size webpages, and (b) the gzip compression make advantage of the redundance of these special characters and thus compress the page effisciently enough.</p> ]]></content:encoded> </item> <item><title>By: Nouman Saleem</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-7931</link> <dc:creator>Nouman Saleem</dc:creator> <pubDate>Thu, 26 Feb 2009 21:27:33 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-7931</guid> <description>@ loius as I said that was done using html tidy which doesnt do what this script does, unless Im mistaken. This script makes it like the google source code where the files is compressed way further than what html tidy can do</description> <content:encoded><![CDATA[<p>@ loius as I said that was done using html tidy which doesnt do what this script does, unless Im mistaken. This script makes it like the google source code where the files is compressed way further than what html tidy can do</p> ]]></content:encoded> </item> <item><title>By: Louis</title><link>http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/comment-page-1#comment-7924</link> <dc:creator>Louis</dc:creator> <pubDate>Thu, 26 Feb 2009 16:53:00 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/compress-xhtml-page-output-php-output-buffers/#comment-7924</guid> <description>@Nouman: I don&#039;t understand your remark. Your PHP code &quot;gets rid of tabs, line breaks, and extra spaces&quot;, and as I initially pointed out, that is not a relevant thing to do to optimize loading times and co.</description> <content:encoded><![CDATA[<p>@Nouman: I don&#8217;t understand your remark. Your PHP code &#8220;gets rid of tabs, line breaks, and extra spaces&#8221;, and as I initially pointed out, that is not a relevant thing to do to optimize loading times and co.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 2/18 queries in 0.013 seconds using disk: basic
Object Caching 865/868 objects using disk: basic

Served from: davidwalsh.name @ 2012-02-09 12:18:31 -->
