This is an old revision of the document!
This tutorial will walk you through all the steps necessary to customize Addon template file(s), without touching the original template files in the addon's sub directory. This will only work for addons that use smarty-based templates, located in the addon's directory under a sub-directory named templates/. The addon must also use the built in system for loading those templates, but if an addon uses its own methods for loading templates this tutorial may not work1).
<tip c w>Warning: This is an advanced tutorial, involving making changes to template files.
Before attempting to make changes as described here, be sure you have a firm grasp of the basics.
Addon templates, by their very nature, are very dynamic and closely related with their PHP file counterparts. Because of this there are certain risks involved with customizing such template files, as listed below.
Risks of Customizing System, Module, or Addon Templates:
</tip>
Skills
Handy tools when editing template files:
Note that by addon template, we mean any template used by an addon, one that is found in the addon's directory, in a sub-directory templates, one that is working "behind the scenes".
Use the following instructions to modify 1 (or more) addon templates. For the purposes of this tutorial, we will demonstrate how to modify addon/example/eWidget_preview.tpl which is a template used by the example addon to display the preview of the example order item named eWidget.
<
<tip c n>Note: When an addon is installed or updated, the templates for that addon are automatically copied from addons/ADDON NAME/templates/ to the default template set at default/addon/ADDON NAME/, except for templates in certain sub-folders that are "special cases". </tip> <
<tip c w>Warning: Only copy files you are going to customize. With every file you copy over, when you next update the Geo software, there is a chance that template file may have changed to work differently, so the fewer files that are copied over, the less chance something might break and need adjustment after an update.
For addons created by Geodesic Solutions, be sure to keep the part at the top of the file that looks like {* $Rev: 12345$ *} - when you update you will be able to compare this "revision number" to the one in the default template set, to see if changes have been made in the new Geo version.</tip> <
There are a few things you should know about how addon templates work within the system, as noted below.
When an addon is installed or updated, the system checks to see if that addon has any templates in the addon folder, in the sub-folder templates/. If it finds any such files, it automatically copies the contents of the folder to geo_templates/default/addon/addon_folder/, including sub-folders and files. See Re-Scaning Default Templates for info on re-copying the templates on all currently enabled addons, to the default template, like is done during addon installation or update.
The following sub-folders are "special cases" and are not copied along with the rest3):