2

I'm sure this is easy but the answer has escaped me. On a drupal install CiviCRM is installed at: /webtree/mysite/htdocs/sites/www.mysite/modules/civicrm

I have a Custom Template File directory set to /webtree/mysite/htdocs/sites/www.mysite/files/civicrm/templates

I'd like to store a custom template file "someText.tpl" in the Custom Template File directory that, depending on some logic, may get included in the Online Event Registration system workflow message using the command:

{include file="someText.tpl"}

If I place the file at: /webtree/mysite/htdocs/sites/www.mysite/modules/civicrm/templates/someText.tpl it is read just fine, but I haven't been able to find a way to place it at /webtree/mysite/htdocs/sites/www.mysite/files/civicrm/templates

I've tried assorted dot notation, full paths, etc. but can't seem to read and include a template that isn't in the module/civicrm/templates path. I'd rather not store my custom files there because it creates extra steps during upgrades. Any suggestions?

  • In your second last paragraph, both paths are the same. Maybe the first should point to the module template path. – Kainuk - CiviCooP Mar 26 '18 at 20:57
  • 1
    If you look close they're a little different, the first is INSIDE the default install location for CiviCRM (sites/mysite/MODULES/civicrm.. while the second is outside that location (sites/mysite/FILES/...UPDATE You're right, I typed it wrong. edited now. – Jeff Wood Mar 26 '18 at 21:43
  • Are your Directories and Resource URLs correctly set? – petednz - fuzion Mar 27 '18 at 18:34
1

You can find some information about overriding templates and the Custom Template Directory in the developer guide here... along with the recommendation that you don't do that but use extensions instead.

1

Just elaborate Aidan's answer:

At Administration Console, Directories, at field: Custom Template Directory, fill in say: [civicrm.files]/custom_templates/

It refers to directory <DocRoot>/sites/default/files/civicrm/custom_templates Go there and make any necessary directory structure corresponding to your include statement. If it is {include file="CRM/Report/Form.tpl"}, then mkdir -p CRM/Report and put Form.tpl there. It would be used if there is a hit.

In case you feel the tpl file you put there is not used, please try this: Administer, System Settings, Cleanup Caches and Update Paths, just click Cleanup Caches. Then go to Dashboard and click Refresh Dashboard Data. Then visit your custom component and see the new changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.