Questions tagged [smarty]
Questions relating to CiviCRM's use of the Smarty templating syntax.
109
questions
0
votes
1
answer
21
views
Is there a better way to handle Smarty template tag errors?
Occasionally our staff users will screw up the tokens in mail; things like {event title} instead of {event.title}
When this happens in a scheduled reminder it causes the reminder to not go out and ...
1
vote
1
answer
37
views
How to check for address type and NULL with a Smarty token after Smarty changes in 5.63?
I am getting two issues after upgrade from 5.58 to 5.63 related to Smarty in message templates.
In one case, the location_type_id no longer seems to valid.
{capture assign=type}{contact....
1
vote
1
answer
36
views
SearchKit: How can I do math on currencies?
I'm trying to replicate a (buggy) report in Extended Reports, basically:
Campaign
Goal
Amount Raised
Amount Left
Capital Campaign
$10,000
$8,000
$2,000
Another Campaign
$15,000
$6,000
$9,000
The ...
4
votes
0
answers
33
views
Calculating the difference between current date and case start date on searchkit
I am currently trying to find the number of days between the current date and the case start date using searchkit. I have tried the "Date between two dates" function on Searchkit, however it ...
0
votes
1
answer
29
views
Smarty include getting illegal string on string error
How to fix Smarty in civicrm 5.63.1
The error originates in the following include from sites/default/files/civicrm/templates_c/en_US/%%1D/1DB/1DB03A28%%CustomField.tpl.php
Message TypeError: Cannot ...
1
vote
1
answer
25
views
Token for contribution.note field in message templates
I have reviewed past posts on this topic, but I'm not a coder so I'm hoping someone can make this straight forward for me. I.e. what code do I need to use, where do I put that code, etc.
We'd like to ...
1
vote
0
answers
49
views
SearchKit: rewrite value dependent on value in a separate field
I am using SearchKit to build a professional membership register in Civi 5.58.1.
I want to show the value in a transformed field from the search (showing professional registration details), only if ...
0
votes
1
answer
49
views
Smarty conditional statement in Message Template (contribution.financial_type_id)
I just can't seem to get any conditional statement to work using Smarty. Essentially, the logic should say, 'if the contribution is Membership Dues, say this. If it's a Donation, say this'.
I'm ...
1
vote
0
answers
15
views
Use Other Rather than Primary Email in Smarty Template
We have Civi CRM 5.53 and I am looking to show people what their registration email is for an event. I am having to use civi rules and so I'm looking to use a Message Template with SMARTY to show the ...
0
votes
1
answer
61
views
Smarty code in email message subject
I know nothing about smarty (it's on my to do list to start learning!) and I'm wondering if it is possible to do something like this in the message subject (or message body) of a bulk email:
If {...
0
votes
2
answers
93
views
Smarty arrays in message template for Thank You letters
I have Smarty enabled in settings file (on WordPress), and I am able to successfully use Smarty in Thank You letter template as long as I am using regular variables (non-arrays).
As soon as I try to ...
1
vote
1
answer
41
views
How to get the Financial Type name/label in Smarty template?
I am using Thank You letter template to generate donation receipt. After using Find Contributions, I then choose All Records and from Actions I choose Thank You Letters.
I can then add smarty logic ...
5
votes
1
answer
372
views
How can I change the date format in a Search Kit result?
I have a Search Kit search that shows the date like this: November 1st, 2012 12:00 AM. I want to reformat this as 11/01/22. How can I do this?
0
votes
1
answer
21
views
CIVICRM_TEMPLATE_COMPILEDIR / template_c folder becomes too large. How to empty it periodically?
We realized that the folder which is set in CIVICRM_TEMPLATE_COMPILEDIR (in our case as per default: template_c) became way too large. From time to time it grew so much that we needed to empty it ...
1
vote
2
answers
55
views
Can I use Smarty in Scheduled reminders?
Title says it all, I need to format some tokens and Smarty doesn't seem to work.
Is it possible to use smarty for Scheduled reminders?
0
votes
2
answers
585
views
Is there way to convert date into timestamp with smarty
I need to calculate a date based on a membership but this has to done with timestamp to have a common numeric value.
We've read almost the whole smarty.net documentation and couldn't find our solution....
1
vote
1
answer
411
views
Smarty syntax error: unrecognized tag?
Does anyone know how I may resolve this issue? I'm running CiviCRM 5.40.0 on WordPress 5.8.1. When I tried to create a new / update contact record, it will throw a PHP Fatal error with the following ...
0
votes
0
answers
60
views
Install error on Wordpress with Smarty.class.php
I have installed CIVI-5.41.0 for WordPress version 5.8.1, updated all the permission as well as php version 8 but still keep getting this error.
Warning: Smarty error: problem creating directory 'D:/...
0
votes
1
answer
66
views
Smarty if instruction in message templates not working in single mails
I try to send single emails (Contacts > New Email) using a message template containing smarty conditional instructions in the html part of the message and in the text part of it.
HTML format:
<p&...
0
votes
1
answer
30
views
Checksum token in system email "Memberships - Receipt (on-line)" causes critical error
When using a checksum token in a receipt email like this:
http://example.org/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=IDNUMBER&{contact.checksum}&cid={contact....
1
vote
1
answer
32
views
Displaying custom contribution field in the online receipt
I am having trouble with displaying a custom contribution field on the online reciept.
With the offline receipt, it works great with this:
{crmAPI var='rname' entity='Contribution' action='getvalue' ...
1
vote
1
answer
43
views
upper case in name with accents
{capture assign=last_name}{contact.last_name}{/capture}{$last_name|upper}
I'm trying to render my contact name in uppercases with Smarty and include letters with accents.
At the bottom of this page ...
1
vote
1
answer
37
views
Smarty for greeting not functioning anymore on civicrm > 5.35
Is there any reason why a custom greeting using smarty wouldn't work anymore on recent versions of CiviCRM:
{if "{contact.gender}"=="Femme"}Chère{ }{contact.first_name}{elseif &...
1
vote
1
answer
30
views
configure URLs in system workflow messages
I've discovered that the URL that is created in the Pledge Acknowledgement and Reminder system workflow messages points to our admin site rather than the public site on our Joomla site. In other words,...
0
votes
1
answer
37
views
Smarty template tokens not translating
We are running civicrm 5.33.1, wordpress 5.7, php 7.4.
The following test template only translates the contact.email greeting, the others stay as they are as do all other tokens in our templates.
Dear ...
2
votes
3
answers
80
views
Insert file into greeting field with Smarty
When the content of the Email Greeting or the Postal Greeting field is getting too long, CiviCRM is no longer able to edit it through the GUI, what happened since I have activated Smarty and inserted ...
1
vote
1
answer
43
views
Display custom contact dashboard only to certain Contact subtypes
Drupal 7.78
Civi 5.28.2
I am setting up a custom contact dashboard following Demerit's answer using UserDashBoard.extra.tpl and smarty's crmAPI.
But I only want it to be for contact sub-type = Student....
1
vote
1
answer
33
views
Smarty test fails in if-then-else
I have an Email greeting containing a Smarty if-then-else expression:
{capture assign=language}{contact.preferred_language}{/capture}{if $language == 'fr_FR'}Bonjour{elif $language == 'nl_NL'}Hallo{...
2
votes
1
answer
52
views
Activating Smarty
I'm trying to send end of year tax letters to donors. I want to customize the letters/emails with their total donation amount for the whole year. I understand I need to activate "smarty" to ...
0
votes
1
answer
84
views
How to know if Smarty is really activated on WordPress?
On WP 5.6 / CiviCRM 5.32 we can't succeed to send HTML e-mails using css in <style> and {literal} (see this post) knowing that we succeed in sending html templates with in-line css.
Smarty is ...
1
vote
2
answers
45
views
Smarty contribution summary works on one site, but not another on the same server
I have burned hours on this and feel at a wall. Would appreciate some fresh eyes to shed light on new avenues of exploration.
I am using "find Contributions" to generate a list of ...
0
votes
3
answers
46
views
Civicrm Event Info Page has Register, iCal, and iCal feed buttons too close to each other
I'm using CiviCRM with wordpress for first time, but the same "issue" exists with Drupal. The bottom "Register Now" button on the info page for an event is very close to two more ...
1
vote
1
answer
3k
views
Create array in Smarty template
I want to modify the Smarty template sites/all/modules/civicrm/templates/CRM/Case/Audit/Report.tpl. I want to complement an existing foreach expression with comparing the incoming variable $group....
2
votes
2
answers
439
views
PHP Fatal error: Smarty error: [in string: (...)]: syntax error: (secure mode) (...) not allowed in if statement (...)
The CiviCRM doumentation describes, how to use Smarty to customize templates for mails and pdf's:
https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/#smarty
E.g.:
{capture ...
0
votes
1
answer
18
views
How to adjust the column width of an item on a contribution receipt?
As it can be seen from screenshot below, the "QTY" column is too close to the "Donation amount" and often times it can be mistaken as "1081" instead of "108". Is there a way to adjust the column width ...
1
vote
1
answer
44
views
How to include source page URL in donation page email receipt?
When my CiviContribute donation pages send out email receipts, I would like the emails to include the URL of the source page (i.e., the WordPress page that contains the shortcode of the CiviCRM ...
2
votes
1
answer
53
views
failed to open stream after PHP upgrade to 7.3
Started getting this error on some Civi pages after upgrading PHP to 7.3 on server running php-fpm and nginx.
Works fine after restarting php-fpm but need to restart every morning to get around ...
3
votes
1
answer
52
views
Issue with CK editor <wbr> tag appearing in Token
In the CK editor, when I add a token and look at the source code, the wbr/> tags appear in the token breaking the token. I have a feeling this crept in after I enabled Smarty for email. Does anyone ...
0
votes
1
answer
59
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
1
answer
66
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
0
answers
24
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
{/...
2
votes
1
answer
58
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
0
answers
55
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
1
answer
33
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
1
answer
80
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
1
answer
46
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 ...
4
votes
1
answer
401
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
1
answer
89
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
2
answers
192
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
2
answers
69
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 ...