Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8201

Allow javascript or other smarty code to be appended to any template using an 'extra' file in the custom template directory

    Details

    • Type: New Feature
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.1
    • Fix Version/s: 3.4.3, 4.0.3
    • Component/s: None
    • Labels:
      None

      Description

      This allows admins to add javascript or other smarty code to the civicrm output without modifying core. The 'extra' file is appended to the core template content.

      Here are the steps:

      1. Create and set a custom template directory
      2. Name your file with the same name and location as the custom template file, but with the suffix / extension of ".extra.tpl" replacing ".tpl"
      3. Create the new file in the same path as a custom template file would be (including directory location)

      EXAMPLE: An additional file which you want to be loaded with the Contact Edit form should be named / stored as:

      CUSTOM_TEMPLATE_DIR/CRM/Contact/Form/Contact.extra.tpl

      Note that if your file contains Javascript, you will need to start your "extra" custom file with the Smarty

      {literal} tag and the <script> tag. Then use {/literal}{$variable}{literal}

      if you need to use any Smarty code or variables. Finally, end the file with </script>

      {/literal}

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              lobo Donald A. Lobo
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: