Answers.Body: <p>I see the name of the function is <code>attachments</code> and the file name is <code>attachment</code>. Maybe, you just need to remove an extra "s" from the function name? </p>
  
  <pre><code>function smarty_function_attachment(array $params, Smarty_Internal_Template $template) {
    .
    .
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-03T17:03:17.730Z
Answers.Text: jitendra, thanks for the reply.
  You're right on the name ma. even by varying it, the function is not called
Answers.UserDisplayName: marcello
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-03T10:19:32.867Z
Answers.LastActivityDate: 2018-12-03T10:19:32.867Z
Answers.UserDisplayName: jitendra - fuzion
Body: <p>I have configured the "Custom" folders for templates and PHP
  following <a href="https://docs.civicrm.org/dev/en/latest/framework/templates/extending-smarty/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/framework/templates/extending-smarty/</a> </p>
  
  <p>I created this hook file (and I'm sure it's executed)</p>
  
  <pre><code>function joomla_civicrm_config(&amp;$config) {
    $smarty = CRM_Core_Smarty::singleton();
    array_push($smarty-&gt;plugins_dir, __DIR__ . '/plugin/');
  }
  </code></pre>
  
  <p>in the "plugin" subfolder (relative to the hook file), I created the function.attachment.php with the code</p>
  
  <pre><code>function smarty_function_attachments(array $params, Smarty_Internal_Template $template) {
    $template-&gt;smarty-&gt;loadPlugin('...');
  }
  </code></pre>
  
  <p>but this last function is not performed.
  Where am I wrong?</p>
  
  <p>Thank you</p>
  
Tags: <smarty><custom-templates>
Title: Extend templates through the hook file
ThreadText: # Extend templates through the hook file
  
  (Asked by: username_0 on 2018-12-03)
  
  I have configured the "Custom" folders for templates and PHP
  following <https://docs.civicrm.org/dev/en/latest/framework/templates/extending-smarty/>
  
  I created this hook file (and I'm sure it's executed)
  
  ```
  function joomla_civicrm_config(&$config) {
    $smarty = CRM_Core_Smarty::singleton();
    array_push($smarty->plugins_dir, __DIR__ . '/plugin/');
  }
  
  ```
  
  in the "plugin" subfolder (relative to the hook file), I created the function.attachment.php with the code
  
  ```
  function smarty_function_attachments(array $params, Smarty_Internal_Template $template) {
    $template->smarty->loadPlugin('...');
  }
  
  ```
  
  but this last function is not performed.
  Where am I wrong?
  
  Thank you
  
  **Tags:** smarty, custom-templates
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-12-03. Score: 1
  
  I see the name of the function is `attachments` and the file name is `attachment`. Maybe, you just need to remove an extra "s" from the function name?
  
  ```
  function smarty_function_attachment(array $params, Smarty_Internal_Template $template) {
    .
    .
  }
  
  ```
  
  > **Comments:**
  > **username_0**: username_1, thanks for the reply. You're right on the name ma. even by varying it, the function is not called  
  
  ---
  
  