Questions tagged [smarty]
Questions relating to CiviCRM's use of the Smarty templating syntax.
131
questions
0
votes
1
answer
26
views
Using Smarty in Search Kit
I have a field for Ethnicity with approx 20+ options to choose from, but the local authority only use White/Non-white classifications for somethings (I don't know why...)
I think it's possible to use ...
0
votes
0
answers
9
views
Trouble-shooting SmartyException: "Unable to load template ... in 'file:CRM/common/CMSPrint.tpl'"
I'm trying to learn how to add my first page to my CiviCRM extension. All it want is for civicrm/dev to display "Hello World."
I think I have Page/Dev.tpl in the correct location, but ...
1
vote
1
answer
25
views
Smarty $template_dir Protected Property problem on upgrade from 5.73.4 to 5.74.0
Running CiviCRM on Joomla 3.10.12 I'm trying to upgrade from CiviCRM 5.73.4 to 5.74.0 and upwards for a client. I've upgraded it from 5.2.1 through to 5.73.4 so far. Its on localhost XAMPP, PHP 8.10. ...
0
votes
1
answer
12
views
Smarty warning for participant_status when someone is registering for the waitlist
Drupal 10.3.1
CiviCRM 5.75.1
PHP 8.2
Smarty 4
When someone registers for the waitlist, the email contains the following two warnings:
Warning: Undefined array key "participant_status" in /...
0
votes
1
answer
44
views
CiviCRM on WordPress SMARTY issue Tag 'crmAPI' disabled by security setting
I am using CiviCRM v5.75.0 on WordPress v6.6.1
When I go to generate a PDF Thank You letter using a saved smarty template that used to work, I get the following error message:
Message was not parsed ...
0
votes
1
answer
70
views
Enable Smarty Version 5
I'm running a Drupal 7 site with CiviCRM version 5.73.1
I understand that CiviCRM will be upgrading Smarty from version 2 to 5 soon (re: https://lab.civicrm.org/dev/core/-/issues/4146) and I would ...
0
votes
2
answers
132
views
CiviCRM update 5.73.1 appears to have broken smarty and we cannot generate letters
After a recent upgrade, we are not able to produce letters anymore. The error when trying is: Network Error Unable to reach the server. Please refresh this page in your browser and try again. This ...
1
vote
1
answer
49
views
Event registration error on confirmation. Probably Smarty, but I'm not consciously using it
I am having trouble with event registrations on an event that seemed to work fine a couple of months ago. The live event happened with no issues back in Jan and Feb. We've since re-activated the event ...
0
votes
0
answers
18
views
Apostrophes in Message Templates / Event Confirmation Email
Not a question per se, more a note of caution: if an additional text contains apostrophes (as in this year's, didn't, Alzheimer’s ) the whole bunch of the text disappears silently from emails. Be ...
2
votes
1
answer
112
views
SmartyException: "Unable to load template 'file:relationship2summary.tpl
I have a CiviCRM plugin in my worpdress website and I am getting following exception while clicking on single "View" in contacts :
SmartyException: "Unable to load template 'file:...
0
votes
2
answers
24
views
Mailing subject length when using Smarty
I am trying to make mailing subject lines automatically bilingual by using Smarty code, but I am running into an issue as the required code easily busts the 128 max character length for subject values....
0
votes
0
answers
21
views
Smarty issue with "conference_sessions" in confirmation email of event registration
Drupal 9.5.1 CiviCRM 5.68
I am preparing an event. There is a Smarty error which appears in the participant's confirmation email. I am not capable of correcting it. Is there some way I can suppress ...
2
votes
1
answer
185
views
Indirect modification of overloaded property CRM_Core_Smarty::$template_dir has no effect
I've followed the instructions in recent versions of CiviCRM and added this line to civicrm.settings.php:
define('CIVICRM_SMARTY3_AUTOLOAD_PATH',
'/home/<username>/public_html/sites/all/modules/...
2
votes
1
answer
49
views
Switch back from Smarty3 to Smarty2 - CiviCRM 5.71.1
Is there a way to switch back from Smarty3 to Smarty2
CiviCRM 5.71.1 + WordPress
0
votes
1
answer
83
views
Error-Message after update Smarty v2 => Smarty v3 (CiciCRM 5.71.1, Joomla)
following the instructions on the CiviCRM status page, I have added this code in civicrm.settings.php to update on Sparty v2 to v3:
define('CIVICRM_SMARTY_AUTOLOAD_PATH',
'/var/www/vhosts/mywebsite....
0
votes
1
answer
283
views
Smarty error after upgrading civicrm from 5.69.4 to 5.70.0
I'm still using smarty 2, PHP 7.4, drupal 7.99
(note: I have a test site for php 8 and smarty 3 and there are problems with both)
After upgrading from civicrm 5.69.4 to 5.70.0 getting the following ...
1
vote
0
answers
21
views
Assignment of related custom field occurs critical Error
I'm encountering an issue regarding the generation of salutations in message templates. The requirement is to first filter whether the contact is an individual or an organization, specifically ...
4
votes
1
answer
257
views
Message templates token replacement: is it {if membership_end_date} or {if {membership_end_date}}?
And similarly, would it be {membership_end_date|crmDate} or {{membership_end_date}|crmDate}?
1
vote
0
answers
102
views
Smarty 3: Unable to load template 'file:CRM/Airmail/Form/Airmail/Settings.tpl' in 'file:CRM/Form/default.tpl'
Drupal 7, CiviCRM 5.69.2, PHP 7.4, Smarty 3.
After civix upgrade run on some extensions (Airmail, Sendgrid) got two identical messages on the respective Settings URL/page:
Unable to load template '...
2
votes
1
answer
370
views
fatal error in "Smarty" after 5.69.2 upgrade
After upgrading CiviCRM to 5.69.2 (along with several extensions), I'm occasionally getting the following error:
Fatal error: Type of SmartyCompilerException::$line must be int (as in class Exception)...
0
votes
2
answers
104
views
Is it the end of the road for CiviCRM under Windows?
We run CiviCRM under Drupal and Windows/IIS. Having upgraded our test environment to 5.69.2, we found we could not register for events, as we got errors along the lines of:
unable to write file <...
1
vote
1
answer
105
views
CSV Download from a custom pop up
I have a function that lists score for a dog:
<h3>Your Dog's Scores</h3>
{crmButton href="#" class="button-name" title="Download CSV" icon="icon-class-...
0
votes
1
answer
58
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
118
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
103
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 ...
5
votes
0
answers
85
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
144
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
30
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
1
answer
190
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
115
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
16
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
130
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
138
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
59
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
616
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
32
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
75
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
995
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
580
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
74
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
95
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
36
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
37
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
2
answers
57
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
43
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
33
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
41
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
84
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
46
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
37
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{...