<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Archetyped &#8250; Cache</title>
	<atom:link href="http://archetyped.com/tag/cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://archetyped.com</link>
	<description>Explore, Experiment, Inspire</description>
	<lastBuildDate>Thu, 10 May 2012 19:19:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Lab &#8250; SLB: Compatibility with Caching Plugins</title>
		<link>http://archetyped.com/lab/slb-compatibility-with-caching-plugins/</link>
		<comments>http://archetyped.com/lab/slb-compatibility-with-caching-plugins/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 03:24:36 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Simple Lightbox]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://archetyped.com/auto-draft/</guid>
		<description><![CDATA[Julio recently pointed out that was not working when W3 Total Cache was activated.  After some digging, it turns out that when the CDN functionality of W3TC is enabled, there are some scenarios where SLB will not be able to load an image. Just the Facts W3TC uses output buffering to process a page before ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.colegioyapeyu.edu.ar/" target="_blank">Julio</a> recently pointed out that <a href="http://archetyped.com/tools/simple-lightbox/" title="Simple Lightbox">Simple Lightbox</a> was not working when W3 Total Cache was activated.  After some digging, it turns out that when the CDN functionality of W3TC is enabled, there are some scenarios where SLB will not be able to load an image.</p>
<h2>Just the Facts</h2>
<ul>
<li>W3TC uses output buffering to process a page before it is displayed in the user&#8217;s browser.</li>
<ul>
<li>If the CDN functionality is enabled, then it uses regular expressions to find/replace all URIs that are <strong>enclosed in quotes</strong>.</li>
</ul>
<li>SLB works with attachment links by retrieving the attachment image source URI at runtime &amp; adds it to the <code>rel</code> attribute of the link</li>
<ul>
<li>Example: <code>rel="slb_source[image_uri.jpg]"</code></li>
</ul>
</ul>
<h2>Scenarios</h2>
<p>The only scenario where there will be an issue is when <strong>W3TC&#8217;s CDN functionality is enabled</strong> and <strong>attachment links are used</strong> when inserting images/galleries into a post.  Default links that point directly to image files are unaffected and continue to work properly.</p>
<h2>A Quick (and Dirty) Solution</h2>
<p>Since W3TC&#8217;s regular expressions work on URLs enclosed in quotes, a quick and dirty solution is to simply add single quotes to the image source value in the <code>rel</code> attribute:</p>
<pre class="brush:xml;gutter:false;">rel="slb_source['image_url.jpg']"</pre>
<p>This has been tested and allows the SLB to work with the updated image URIs pointing to the CDN.</p>
<h3>Pros</h3>
<ul>
<li>Consistent: Source URI in <code>rel</code> attribute is processed like all other internal URIs in post output</li>
<li>Automatic: No change unless W3TC output buffering is executed</li>
</ul>
<h3>Cons</h3>
<ul>
<li>Dependent on being compatible with W3TC regular expressions</li>
<ul>
<li>If W3TC&#8217;s code changes, SLB compatibility may break</li>
</ul>
</ul>
<h3>Questions</h3>
<ul>
<li>Problems with single quotes in <code>rel</code> attribute?</li>
</ul>
<p>I&#8217;m not a fan of functional code that is dependent on external code, but if adding single quotes do no harm <em>and</em> provide compatibility with W3TC, then this may very well be the solution I will implement.  After a bit of testing, it will probably be released in <a href="http://archetyped.com/lab/slb-1-5-6-beta/" title="SLB 1.5.6 Beta">SLB 1.5.6b2</a> in the next couple days.</p>
<p><a href="http://archetyped.com/lab/slb-compatibility-with-caching-plugins/"> SLB: Compatibility with Caching Plugins</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on September 7, 2011 05:24pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/slb-compatibility-with-caching-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

