Custom template include files are an easy and convenient way to modularize your custom template code. You simply save a piece of code -- from one line to as much as you want -- as a separate file, then use an [-- INCLUDE filename --] tag where you want to place that code in your template. You can use include files for several purposes:
This simple CSS style sheet could be saved as an include file, and then used in page templates, more info page templates, and shopping cart templates.
You could include the style sheet with an [-- INCLUDE filename --] tag. Because the code in the include file contains custom template tags, you must use the PROCESS attribute to have ShopSite parse those tags. Here is an example at the top of a custom page template:
ShopSite comes with many include files that are used by the templates for the built-in themes, such as the Tabbed Navigation theme. You can use these same include files in your own templates. You can use them as-is, or copy them and customize them to meet your needs. (You should copy any include file that you are considering using and study the code to make sure it will work for you.)
Include files can contain [-- INCLUDE --] tags for other include files. In other words, include files can be nested. Some of the built-in include files include other files, and they are listed under "Dependencies" in the table below.
Some of the include files assume that one or more variables are already defined before they are invoked by a template. These are indicated with "VAR" under "Dependencies" in the table below. If you want to use one of those include files, you can either define the variables in your template, or edit your copy of the include file and define the variables near the top of the file.
Return to the Custom Template Cookbook