User Tools

Site Tools


tutorials:design_adv:replace_addon_templates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:design_adv:replace_addon_templates [2009/08/13 21:06]
jonyo
tutorials:design_adv:replace_addon_templates [2014/09/30 17:37] (current)
geojames
Line 2: Line 2:
 ====== Customizing Addon Templates ====== ====== Customizing Addon Templates ======
  
-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 it's own methods for loading templates this tutorial may not work((All addons created by Geodesic Solutions that use Smarty templates, this tutorial will work for.  Addon developers:  Just make sure you use the **geoTemplates** and/or **geoView** classes when using Smarty templates.  If you use the Smarty class directly, the methods described in this tutorial will not work for your clients.)). +This support wiki article has been [[startup_tutorial_and_checklist:design_configuration:design_tools:system_template_changes:addon_changes|moved here in the support wiki]]
- +
-<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 [[tutorials/design/start|the basics]]**. +
- +
-Depending on the use, Addon templates, can be very dynamic and closely related with their PHP file counterparts in the Addons.  Be prepared to adjust any addon templates you customize to make it compatible when you update to a new version of the Addon((Which will happen automatically for any addons built into the Geo software, such as the Security Image Addon.)).  For Addons created by Geodesic Solutions, see [[tutorials/design_adv/replace_system_templates#Geo Updates & Customized Templates]] for more info, and be sure to read those sections **BEFORE** a problem occurs, as they have some pre-update steps that will help the transition. +
- +
-Also note that supporting file-based template changes is outside the scope of the support we offer for Geo support.  This is especially true for 3rd party Addons, you will need to contact the author of the addon for support.  For addons created by Geodesic Solutions, Geo Support can try to help you with the //how// and //where// for editing templates, but they cannot make changes for you or try to troubleshoot problems related to customized templates.</tip> +
- +
-===== What you need ===== +
-**Skills** +
-  * Comfortable with using FTP (to upload and download template files from your site) < +
-  * Basic understanding of how HTML, Smarty Templates, and/or PHP works will help. < +
-  * Not afraid to learn new things. ;-) < +
- +
- +
-**Handy tools when editing template files:** +
-  * [[http://smarty.net/manual/en/|Smarty Documentation]] < +
- +
- +
-===== Getting Started - Creating a Template Set ===== +
- +
-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 **addons/example/templates/eWidget_preview.tpl** which is a template used by the example addon to display the preview of the example order item named eWidget. +
- +
-  - In your Geo admin pages for the addon, and in the documentation for the addon, check to see if what you are attempting to accomplish can already be done by changing settings in the admin.  You might find that you can already do what you are needing by making a setting change, which is always the better option over editing a template file. < +
-  - Using FTP, create a new directory **geo_templates/my_templates/** (you can name my_templates to whatever you want). < +
-  - In that directory, create a sub-directory named **addon/**.  Then inside that directory, create a new directory named the exact same as the addon's main directory, in the case of the example addon, it would be **example/**. +
-  - Duplicate the //directory path// for the template you wish to modify, if the template is found in a sub-directory of the addon templates.  In this case, the two directory locations listed below are equivalent. +
-    * **addons/example/templates/** - Where the original template files are located. < +
-    * **geo_templates/my_templates/addon/example/** - Over-riding templates in a template set, any templates found in this location will be used instead of the ones found in the addon's own templates directory. < +
-+
-  - Copy the file **addons/example/templates/eWidget_preview.tpl** to the newly created **geo_templates/my_templates/addon/example/** directory.  This is a comparison of the 2 files so you can better see how to set it up:\\ +
-**Original template file (ships with addon, do not edit)** +
-  addons/example/templates/eWidget_preview.tpl +
-**Customized template file (you create and edit this one)** +
-  geo_templates/my_templates/addon/example/eWidget_preview.tpl +
-+
-  - Repeat the copy for any other templates you may want to customize.  Note that you should **not** copy a file unless you plan to customize it.  You do not need to worry if the file you are customizing //includes// another template file, if you do not copy that template file, when it is included the system will automatically look for the file in the addon's templates if it is not found in **my_templates** template set. +
-<tip c w>**Warning:** Only copy files you are going to customize.  With every file you copy over, when you next update the addon, 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. +
- +
-Also, on addon templates 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 from the addon templates, to see if changes have been made in the new addon version.</tip> +
-+
-  - In the admin, on the page [[admin_menu:templates:template_system:start|Templates > Template System]] click on [[admin_menu:templates:template_system:start#Use Set]] next to the **my_templates** template set. < +
- +
-Now, the **my_templates** should be at the top of the template sets to use in the admin.  This means that any template found in that template set, will be used, if a template is not found in that template then it uses the one from the addon's template directory. +
- +
-Make changes to the file(s) in **geo_templates/my_templates/**.  **Do not** change files in **addons/ADDON_NAME/templates**, as they will be over-written during an update.  Also the templates in the default template set are fair game to be over-written by Geo support for troubleshooting purposes. +
- +
-===== See Also ===== +
-  * [[admin_menu:templates:template_system:start|Templates > Template System]] - Help for the template system page in the admin < +
-  * [[tutorials:design_adv:replace_db_templates]] +
  
tutorials/design_adv/replace_addon_templates.1250197569.txt.gz · Last modified: 2014/09/25 16:55 (external edit)