Answers.Body: <p>You can use</p>
  
  <pre><code>{crmResURL ext='civicrm.files'}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T02:22:12.483Z
Answers.Text: Thanks, I didn't know that (where's it documented, do you know?). However it returns a server path not a URL so it's not much use in an email or for generating a PDF.
Answers.UserDisplayName: Phil McKerracher
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T07:00:31.390Z
Answers.Text: I find it in the code, on the place were the help screen is generated https://github.com/civicrm/civicrm-core/blob/648631cd94799e87fe2347487d465b1a7256aa57/templates/CRM/Admin/Form/Setting/Url.hlp . But in the first try I had the wrong screen. It must be crmResURL. I updated the answer.
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T13:19:38.163Z
Answers.Text: Brilliant, I just guessed it myself and came back here and you had already answered. I've marked this as the answer, thanks very much @Kainuk! It's a shame such a little thing is so hard to find though.
Answers.UserDisplayName: Phil McKerracher
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-16T15:51:09.223Z
Answers.LastActivityDate: 2017-08-23T06:58:02.943Z
Answers.LastEditDate: 2017-08-23T06:58:02.943Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>Details on the Smarty CiviCRM interface are here: <a href="https://docs.civicrm.org/dev/en/master/api/interfaces/#smarty-api-interface" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/master/api/interfaces/#smarty-api-interface</a></p>
  
  <p>However, this seems like overkill for handling the date issue.  I suspect that this can be fixed by changing the currency settings (<strong>Administer menu » Localizations » Languages, Currency, Location</strong>).  If this does NOT fix your issue, that's a bug and should be reported.</p>
  
  <p>As for the logo issue - I don't think there's a way to do what you're asking without an extension.  Fortunately, it should be a very small extension, maybe 5-10 lines of code using <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailParams/" rel="nofollow noreferrer">hook_civicrm_alterMailParams</a>.  Best yet, you don't have to deal with Smarty :-\</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-15T17:21:55.060Z
Answers.Text: Thanks, that Smarty interface link is helpful.
  
  I confirm that the localization settings don't fix the date format issue and I can see the format is hard coded in Invoice.php, so I will raise a bug report.
  
  I may have found a partial solution to the logo issue, see below.
Answers.UserDisplayName: Phil McKerracher
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-15T19:17:13.770Z
Answers.Text: Also note that you can add a `{debug}` token to your Smarty template to see all variables.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T02:19:55.607Z
Answers.Text: {debug} has no effect - I assume because javascript doesn't run in a PDF file?
Answers.UserDisplayName: Phil McKerracher
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T13:34:20.817Z
Answers.Text: Hmm, the docs here https://docs.civicrm.org/dev/en/master/framework/templates/ say you need to enable debugging first at Administer > Configure > Global Settings > Debugging. That tree doesn't exist but I found a similar setting at Administer > System Settings > Debugging and Error Handling. But it doesn't make any difference. I'm lost in a maze of twisty little passages.
Answers.UserDisplayName: Phil McKerracher
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-15T17:00:43.160Z
Answers.LastActivityDate: 2017-08-15T17:00:43.160Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I'd like to replace the default logo in my email templates ({$resourceBase}/i/civi99.png) with a URL that points to a different location where the custom logo won't be overwritten by updates. I can do that by directly editing the template to point to <a href="https://www.mydomain.com/images/logo.png" rel="nofollow noreferrer">https://www.mydomain.com/images/logo.png</a> for example, but I'd like to avoid asking customers to edit the templates, which requires programming skills. Instead, I'd like to tell them to put their logo in a magic folder where it will be picked up if it exists.</p>
  
  <p>Probably [civicrm.files] would be a suitable location but I can't work out how to expand that in a smarty template. </p>
  
  <p>I tried {crmSetting name="imageUploadURL" group="URL Preferences"} but that returns "[civicrm.files]/persist/contribute/" which doesn't expand the variable.</p>
  
  <p>I also tried {crmResURL ext=civicrm} but that just gives "/wp-content/plugins/civicrm/civicrm/" which is not a complete URL and in any case points to a directory that will get overwritten by updates (yes I'm on WordPress).</p>
  
  <p>I haven't yet found where $resourceBase is set but something equivalent that returns <a href="https://www.mydomain.com/wp-content/uploads/civicrm" rel="nofollow noreferrer">https://www.mydomain.com/wp-content/uploads/civicrm</a> would be good. I think I can only create that new variable by writing an extension though, which is a lot of bother if there's a better way. I would have expected the root URL of the installation to be in the settings or global variables somewhere and accessible from smarty but I can't find it. </p>
  
  <p>A possibly related problem is that I'd also like to retrieve information like the date of a contribution from the database and display that in an email. Again, I can see that information is put in a smarty variable in Invoice.php for example, but the format is wrong (American, comma in wrong place) and my hunch is the information should be accessible some other way through the API. But if so I can't find it.</p>
  
  <p>I've spent several hours on this (even bought the book) and I'm still struggling to find any information on how to create or use variables like [civicrm.files] in general, and in smarty in particular. Can any one help with either a specific or a general solution?</p>
  
  <p>Update: I've found a partial solution to the logo path problem.
   {$smarty.server.SERVER_NAME} will get the name of the "server", in a format like "www.mydomain.com". By sticking "https://" in front and "/wp-content/uploads/civicrm" at the end you can make a good guess at where civicrm.files is likely to be on a WordPress installation. But it's only a guess.</p>
  
Tags: <message-templates><smarty><resource-urls>
Title: Is there a way to access [civicrm.files] from smarty?
ThreadText: # Is there a way to access [civicrm.files] from smarty?
  
  (Asked by: username_0 on 2017-08-15)
  
  I'd like to replace the default logo in my email templates ({$resourceBase}/i/civi99.png) with a URL that points to a different location where the custom logo won't be overwritten by updates. I can do that by directly editing the template to point to <https://www.mydomain.com/images/logo.png> for example, but I'd like to avoid asking customers to edit the templates, which requires programming skills. Instead, I'd like to tell them to put their logo in a magic folder where it will be picked up if it exists.
  
  Probably [civicrm.files] would be a suitable location but I can't work out how to expand that in a smarty template.
  
  I tried {crmSetting name="imageUploadURL" group="URL Preferences"} but that returns "[civicrm.files]/persist/contribute/" which doesn't expand the variable.
  
  I also tried {crmResURL ext=civicrm} but that just gives "/wp-content/plugins/civicrm/civicrm/" which is not a complete URL and in any case points to a directory that will get overwritten by updates (yes I'm on WordPress).
  
  I haven't yet found where $resourceBase is set but something equivalent that returns <https://www.mydomain.com/wp-content/uploads/civicrm> would be good. I think I can only create that new variable by writing an extension though, which is a lot of bother if there's a better way. I would have expected the root URL of the installation to be in the settings or global variables somewhere and accessible from smarty but I can't find it.
  
  A possibly related problem is that I'd also like to retrieve information like the date of a contribution from the database and display that in an email. Again, I can see that information is put in a smarty variable in Invoice.php for example, but the format is wrong (American, comma in wrong place) and my hunch is the information should be accessible some other way through the API. But if so I can't find it.
  
  I've spent several hours on this (even bought the book) and I'm still struggling to find any information on how to create or use variables like [civicrm.files] in general, and in smarty in particular. Can any one help with either a specific or a general solution?
  
  Update: I've found a partial solution to the logo path problem.
  {$smarty.server.SERVER\_NAME} will get the name of the "server", in a format like "www.mydomain.com". By sticking "https://" in front and "/wp-content/uploads/civicrm" at the end you can make a good guess at where civicrm.files is likely to be on a WordPress installation. But it's only a guess.
  
  **Tags:** message-templates, smarty, resource-urls
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-08-16. Score: 2 | Accepted answer
  
  You can use
  
  ```
  {crmResURL ext='civicrm.files'}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks, I didn't know that (where's it documented, do you know?). However it returns a server path not a URL so it's not much use in an email or for generating a PDF.  
  > **username_1**: I find it in the code, on the place were the help screen is generated https://github.com/civicrm/civicrm-core/blob/648631cd94799e87fe2347487d465b1a7256aa57/templates/CRM/Admin/Form/Setting/Url.hlp . But in the first try I had the wrong screen. It must be crmResURL. I updated the answer.  
  > **username_0**: Brilliant, I just guessed it myself and came back here and you had already answered. I've marked this as the answer, thanks very much @username_1! It's a shame such a little thing is so hard to find though.  
  
  ---
  
  ### Answer by username_2 on 2017-08-15. Score: 1
  
  Details on the Smarty CiviCRM interface are here: <https://docs.civicrm.org/dev/en/master/api/interfaces/#smarty-api-interface>
  
  However, this seems like overkill for handling the date issue. I suspect that this can be fixed by changing the currency settings (**Administer menu » Localizations » Languages, Currency, Location**). If this does NOT fix your issue, that's a bug and should be reported.
  
  As for the logo issue - I don't think there's a way to do what you're asking without an extension. Fortunately, it should be a very small extension, maybe 5-10 lines of code using [hook\_civicrm\_alterMailParams](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMailParams/). Best yet, you don't have to deal with Smarty :-\
  
  > **Comments:**
  > **username_0**: Thanks, that Smarty interface link is helpful.  I confirm that the localization settings don't fix the date format issue and I can see the format is hard coded in Invoice.php, so I will raise a bug report.  I may have found a partial solution to the logo issue, see below.  
  > **username_2**: Also note that you can add a `{debug}` token to your Smarty template to see all variables.  
  > **username_0**: {debug} has no effect - I assume because javascript doesn't run in a PDF file?  
  > **username_0**: Hmm, the docs here https://docs.civicrm.org/dev/en/master/framework/templates/ say you need to enable debugging first at Administer > Configure > Global Settings > Debugging. That tree doesn't exist but I found a similar setting at Administer > System Settings > Debugging and Error Handling. But it doesn't make any difference. I'm lost in a maze of twisty little passages.  
  
  ---
  
  