−Table of Contents
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
- Pulls in target URL.
- Strips any <base> tags.
- “Convenience replacements”, currently converting “http” to “https” links for:
- Google Analytics
- Imports non-secure external CSS
- Rewrites all image paths (
*.jpg
,*.jpeg
,*.png
,*.gif
) to use FoxyCart image caching. - Sticks it inline, inside CDATA comments.
- 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.
- Rewrites all
<img>
paths to use FoxyCart image caching. - Rewrites all
<a>
paths to point to the correct locations. - Rewrites all
<form>
actions to point to correct locations.
What Is Supported?
- Most everything not listed below.
Important Notes
- Preventing Hotlinking? If you're running scripts to prevent hotlinking, that may interfere with the template caching. If images aren't showing up properly, turn off your hotlinking protection while you cache your templates.
- Attributes must be enclosed in single or double quotes like
src=“foo/bar”
orsrc='foo/bar
'. - Your page must have a UTF-8 content type so you may need to add this inside your document's head tag:
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”/>
. - 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 (likexml
,flv
, etc.) are cached along with theswf
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. These may work if you're using a custom subdomain, but likely will not work if you're using a default
*.foxycart.com
subdomain.
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 We're still figuring this out.
<!–>
, which needs to be included or you'll run into problems with the &
being replaced by &
every time you save your template.
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 ^^
Caching Images Manually
If you don't want to use AutoMagiCache but still need your images securely cached you can do so. View the instructions here.