As described in the previous Introduction to Tripal Templates section, Tripal modules include a variety of templates that provide the content for the panes on a page. These templates can be edited to provide a custom view of data in Chado.
Editing a Template
Customizing a template requires some knowledge of PHP and the Tripal API. The necessary Tripal API functions needed to customize a template can be found in the Tripal Developer's Handbook section of this Guide. Please refer to that section for instructions to access data from a Chado database. It is important to try to not use SQL statements in templates. Tripal provides two API functions, chado_generate_var() and chado_expand_var(), that should provide the access needed to any data housed in Chado without the need for writing SQL statements. However, there are cases where SQL may be needed for complex queries. If you must include SQL statements please be sure to use the Drupal API functions: db_query() and db_select. If you find you require functionality such as the need for forms in a template then best solution is to consider creating a full custom module into which you can override or create new templates and there is greater flexibility for creating such customizations.
After copying the desired template to your site's default theme directory and editing it accordingly, you may need to clear the Drupal cache for it to be noticed. This can be done by navigating to Configuration -> Performance. Or by issuiing the following drush command
cd [drupal dir] drush cc all
Where [drupal dir] is the directory where Drupal is installed.
Best Practice Tip.
Where to put Customized Templates?
By default, Drupal will search for a template file by first looking in the module directories. For example, Drupal will first want to find Tripal related template files in the Tripal module directories. Next, Drupal searches the enabled theme directory. Templates found in the current default theme takes precedence over those in modules. To avoid losing customizations that you create, you should always copy templates you wish to edit to the directory of your default theme. This way, if you upgrade Tripal in the future you do not loose your customizations. Once tempaltes are in your default theme directory then Drupal will show preference for those rather than the original versions that remain in the Tripal module directory.