Template Caching

We affectionately refer to our template caching system as “AutoMagiCache”. It's a whole mess of very exciting regular expressions that will automatically pull in a page from your server, rewrite and cache your paths and images, and store it on our server.

What It Does

  1. Pulls in target URL.
  2. Strips any <base> tags.
  3. “Convenience replacements”, currently converting “http” to “https” links for:
    • Google Analytics
  4. Imports non-secure external CSS
    • Rewrites all image paths (*.jpg, *.png, *.gif) to use FoxyCart image caching.
    • Sticks it inline, inside CDATA comments.
  5. Imports non-secure external JS
    • Replaces // with \/\/ when not preceded by a space or line break.
    • Replaces all </ with <\/.
    • Sticks it inline, inside CDATA comments.
  6. Rewrites all <img> paths to use FoxyCart image caching.
  7. Rewrites all <a> paths to point to the correct locations.
  8. Rewrites all <form> actions to point to correct locations.

What Is Supported?

  • Most everything not listed below.

Important Notes

  • Attributes must be enclosed in single or double quotes like src=“foo/bar” or src='foo/bar'.
  • Flash will not be cached. Because it's near-impossible to “see inside” of a swf file, there's no good way to ensure that additional necessary files (like xml, flv, etc.) are cached along with the swf file itself.
  • “Upward relative paths” (stuff like ../foo/bar.ext) more than one level deep are not supported. ../foo/bar.ext will work, but ../../foo/bar.ext will not. If you have a legitimate need for more than one level deep, let us know.
  • @IMPORT rules more than one level deep are not supported. An import will work just fine, but an import inside an import won't be cached. If you have a legitimate need for more than one level deep, let us know.
  • jQuery must be v1.1.2+ or it will conflict with internal FoxyCart functionality.
  • HTC files. But you can use them on our servers.

Comments, Conditional Comments, and the Ampersand ("&")

For some reason, Firefox and Internet Explorer create problems when you have the ampersand (”&”) character inside of code comments:

<!--
Some text & more
-->

If you rely on conditional comments for Internet Explorer, and inside of those conditional comments you have ampersands, you'll need to use a very specific syntax to include your comments, detailed at Wellstyled.com. The important piece to notice is the <!–>, which needs to be included or you'll run into problems with the & being replaced by &amp; every time you save your template. We're still figuring this out.

Placeholders in your CSS or JS

The following placeholders will be replaced with “spaced” placeholders in cached CSS and JS, to prevent problems with parsing placeholders that shouldn't be parsed.

  • ^^cart^^^^ cart ^^
  • ^^checkout^^^^ checkout ^^
  • ^^receipt^^^^ receipt ^^
  • ^^analytics_google^^^^ analytics_google ^^
 
docs/automagicache.txt · Last modified: 2008/03/12 00:09 by foxybrett
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki