Questions tagged [smarty]

Questions relating to CiviCRM's use of the Smarty templating syntax.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

Unable to insert membership custom field in e-mail using Smarty

I created a custom field set and a custom field used for memberships. Now i would like to insert the data from the custom field into my e-mail template. So i tried to find the custom field id by going ...
2
votes
1answer
25 views

Thank-you letter incorrect contribution currency

My setup: CiviCRM 5.20.0 on Drupal 7. I entered contributions in different currencies. In Find Contributions, check some entries. At Actions select Thank-you letter print or email. I put tokens ...
0
votes
0answers
14 views

Smarty Variable for tax deductible

I'd like to add custom code in my contribution receipts that does the following: {if $contributionIsTaxDeductible == True} No goods or services were exchange for this donation Tax id 12-3456789 {/...
1
vote
1answer
26 views

Smarty with CiviRules

I have a template with Smarty strings. If I send the email from inside CiviCRM, Smarty works fine (it shows "Cher Guillaume"): If I send the same template using a CiviRule, it doesn't work: ...
3
votes
0answers
29 views

Adding conditional content in message template for emails, but not for PDFs

I'm wondering if it's possible to add some conditional logic in my custom user-driven message template to show some content (in this case, a footer) for messages that are sent as emails, but not to ...
1
vote
1answer
20 views

How to show paidby and check_number on Contribution - Receipt (on-line)

CiviCRM 5.16.3 on Drupal 7. I would like to show payment menthods of contribution in template Contribution - Receipt (on-line). I tried to insert $formValues.paidby or $paidby but they show nothing. (...
4
votes
1answer
35 views

Smarty only generating nulls from API calls

Using the Explorer, I built up the smarty code I need for a template to pull in address information on a contact for use in an email: {crmAPI var='result' entity='Address' action='get' contact_id=203}...
3
votes
1answer
31 views

How to suppress translation of months (or all fields) in receipts?

My platform: CiviCRM 5.16.3 on Drupal 7.6.7 PHP 7.2 CentOS 7. Drupal language is English. CiviCRM l10n installed and selected my own languange zh_TW Chinese(Taiwan). At receipt print-outs CiviCRM ...
2
votes
1answer
60 views

SMARTY error with template

I have this issue I don't understand with a civirule that should be sending an email with a .pdf attached when adding a member to a group but it's blocked by Smarty during the process of merging the ...
4
votes
1answer
28 views

Issue with sending html email from civicrm with Smarty

I am testing some templates with smarty and I don't succeed to send them when the email is - apparently - encoded in html. I could send them as normal text message. I could also send html templates ...
1
vote
2answers
145 views

How to use Smarty for change greetings for French?

I need to adapt Greetings in order to fit to French (which has a feminine and masculine for "Dear"). I read on the forum that I should use Smarty and read the short documentation (CiviCRM ...
1
vote
2answers
36 views

How to include smarty script with mosaico email

I used to use a name personalisation in civimail with smarty script... {capture assign=nickname}{contact.nick_name}{/capture} Dear {if $nickname}{contact.nick_name}{else}{contact.sort_name}{/if} I ...
1
vote
1answer
33 views

How to use Contact name if nickname is not present in bulk mail?

I need to send an email with Nickname as first preference, if that not present then use Contact name. Cant figure out what token to use? I have tried this but seems not rendering correctly in email: ...
1
vote
0answers
48 views

Smarty does not display database fields

As a workflow message for a contribution confirmation, i use the following template. All values are displayed, except $financial_type_id and $source. Both stay empty in the output table. How come only ...
3
votes
1answer
77 views

Smarty and Mosaico - compatibility?

Seeing a lot of smarty errors in Drupal log file for mailings using Mosaico template - looks like an error for every message sent so thousands filling log files. Nothing obvious in Mosaico template ...
3
votes
1answer
42 views

How to set a id attribute to button?

I am creating a button using php pear. Button (php code) $this->addButtons(array( /** * Array for 'next' button */ array( 'type' => 'next', 'name' => E::ts('Next'), ...
1
vote
0answers
27 views

I am adding crmButton in the template for EventInfo.tpl , how can I add drupal callback function and makesure it does not breaks as is the case here?

{crmButton p='drupal/event-workflow/$uid/$gid' q="action=browse&reset=1&gid=$gid" icon="th-list"}{ts}Request for Approval{/ts}{/crmButton} Where I have defined $uid and $gid variables in ...
2
votes
0answers
106 views

What does undefined extension class 'Smarty_Internal_Method_Assign_By_Ref' Mean?

The new installation of CIVI works. LAMP server, shared hosting, PHP 7.2, Joomla! 3.9, etc. When I click to go to configuration checklist, I get the error: undefined extension class '...
0
votes
1answer
21 views

Extend templates through the hook file

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 ...
1
vote
1answer
134 views

Custom date field formatting with smarty

I'm trying to format a custom date field using smarty to send emails. What I want is to have the day of the week included, as "Wednesday, April 18, 2018". It seems that this should work: {contact....
2
votes
2answers
64 views

Search Custom Template Directory first when using Smarty {include}

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 ...
0
votes
1answer
241 views

Problems getting smarty to work

I'm not sure where to look - I've tried everything that I can think of to get smarty to work in an email template, but it's just not happening. I'm using CiviCRM 4.7.27 with WordPress 4.9.3. I've ...
2
votes
2answers
211 views

How to check if a contact has an active membership in a smarty template?

Is there a variable that one can use in smarty in a message template to simply determine if a contact has an active membership?
1
vote
3answers
226 views

Show translated string in a template field (using smarty?)

I'm using a custom profile template. I need display different text strings depending on browser language of user... One string for Spanish users and other string for all other users. It seems this ...
2
votes
1answer
90 views

How to deal with ' or (') in CKeditor

I am unable to use smarty in CKeditor because it's transforming the ' into & #39; I couldn't find anything useful when click the configure CKEditor Button in display preferences.
1
vote
1answer
71 views

Displaying Transaction Id in Thank you letter

I am trying to create thank you letters grouping the transactions by contact. I am creating a table to display the contribution information but I am running into a problem with Transaction ID. since ...
1
vote
1answer
33 views

Smarty causing contact import to fail

I have CiviCRM 4.6.28 on Drupal 7.56, hosted on Pantheon. We are trying to import lists of contacts, but anything above 250 contacts throws a timeout error, due to Pantheon's time limits. The time ...
0
votes
1answer
88 views

How to debug Smarty mail template codes, broken after upgrade

I have a few Mail Templates that have conditional smarty codes like: {capture assign=pp_scan}{contact.custom_74}{/capture}{if $pp_scan}You have already provided{else}You have not yet provided{/if} a ...
1
vote
2answers
226 views

Smarty Custom Variable / Token Array

We've written a custom token to pull a piece of custom data off of any open cases. The token works as an imploded variable. I'd like to be able to use the token as an array as well (so I can run a for ...
1
vote
3answers
1k views

If statement involving “is not empty” in smarty template?

How do I do this in a Smarty template: If {contact.supplemental_address_1} is not empty then {contact.supplemental_address_1}
2
votes
1answer
120 views

Smarty code not working

Writing as a self-answered question since it may help others... I am adding smarty code to a mail template. Including: {capture assign=designation}{contribution.contribution_source}{/capture} Later ...
2
votes
2answers
142 views

Is there a way to access [civicrm.files] from smarty?

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 ...
2
votes
1answer
136 views

Custom Email Greeting token doesn't work

I've done a custom email greetings that have this structure: {capture assign=l}{contact.preferred_language}{/capture} {capture assign=g}{contact.gender}{/capture} {if $l=="en_US"}Dear {elseif $l=="...
1
vote
1answer
79 views

Smarty Template CMS-agnostic URL

Please can someone remind me how to create a CMS-safe URL in Smarty Templates? Thanks
2
votes
1answer
65 views

Add 'Non-deductible amount' to Contribution Receipt template

I am trying to add the non-deductible amount to my Automatic Contribution receipt but it is not printing the value. Any tips? I am using Civicrm 4.6.19 with Drupal 7 <tr> <td {$...
3
votes
1answer
52 views

Smarty and future proof code

I am trying to be a more conforming civicrm coder. Smarty used by civicrm for pages (and forms?) I have never used Smarty.. Is it going to be part of civicrm going forward? And are there any tips ...
1
vote
0answers
95 views

Custom Contribution Fields in Message Templates

I've been trying to get my custom contribution fields to be visible in my thank you/receipt message template and I think I am close but not quite there. I have enabled the CIVICRM_MAIL_SMARTY flag in ...
4
votes
2answers
110 views

Is it possible in CiviCRM to change extension of cached php files from .php to something else (e.g. .php_ or .txt)?

Is it possible in CiviCRM to change extension of cached php files from .php to something else (e.g. .php_ or .txt)? Our host (WPEngine) does not allow guest users to write to php files on production ...
2
votes
1answer
149 views

Scheduled Reminder Email is Empty

We are using CiviCRM 4.6 on a live site we built with WordPress 4.6.1. We ran into the problem explained below. Any help is much appreciated. I have set up a scheduled reminder to send reminder ...
2
votes
2answers
214 views

White screen in 4.7.12

I note with the 4.7.12 version of the difficulties of implementation, particularly with queries that only lead to blank pages. Track errors in apache located abnormalities in smarty. I returned to ...
0
votes
1answer
17 views

Same custom field name at Contact Form seems to be different for each logged in user

We've tried to alter some custom fields display (namely, make some fields display data only, not editable text field). It seems that all custom fields logic is inside templates\CRM\Custom\Form\...
6
votes
1answer
85 views

How to go about making a Core Tab on the Contact Summary screen view Inline instead?

Specifically -> I'd like to see what's in the Membership Tab -> Inline instead. I'd like that table with Active Memberships printed right at the top underneath the Display Name on civicrm/contact/view?...
0
votes
1answer
66 views

How do I change the fields shown for participants on the CiviEvent Dashboard?

I'd like to add one of the fields of the contacts in the list of participants shown on the CiviEvent Dashboard. How would I do that? I'm sure it has something to do with the Smarty templating, so ...
1
vote
2answers
48 views

Thankyou.tpl fields

I'm trying to edit the Thankyou.tpl smarty template to expose certain information on the Thank You page after a donation is submitted. Following the CiviCRM wiki it looks like, for instance, printing ...
0
votes
1answer
34 views

Remove link(s) from an Activity View screen via crmReplace

How should {$form.source_contact_id.html} from \civicrm\templates\CRM\Activity\Form\Activity.tpl be altered so only text remains/ without an URL? smarty escape doesn't seems to be a good idea, ...
2
votes
2answers
400 views

Override TPL path dynamically

Is it possible to dynamically override the .tpl file path in CiviCRM? Rather than use the corresponding TPL file to the Class.
1
vote
1answer
92 views

Is there an update safe way to disable smarty security in templates for CiviMail?

I'm using CiviCRM 4.6.14 and I want to write a Template for CiviMail using the smarty templating engine. I need to add some PHP code to that template, but obvious the security setting is set to true ...
1
vote
1answer
72 views

$participant_status_id shows previous value in email template

Using version 4.6.9 on Drupal 7. I'm working on a revision to our email template for event registrants, and in our environment, it's important to distinguish between individuals who are awaiting ...
1
vote
0answers
164 views

Smarty URL for Event confirm Registration

I'm using the Require participant approval feature. CiviCRM 4.6.12 WordPress 4.4.2 I'm trying to send reminders to the people who hasn't already confirmed their place. Having a look at Civi's ...
1
vote
1answer
99 views

How to include price field data in a Contribution Thank You letter

We have a need to display price field information in a contribution Thank You letter. As the token system can't handle the price set data, I've pulled the relevant Smarty code from the receipt ...