Questions tagged [smarty]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
22 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 ...
1
vote
1answer
25 views

SOLVED:: 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
22 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
134 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
28 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
31 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
45 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
57 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
38 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
26 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
85 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
19 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 ...
0
votes
1answer
115 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....
0
votes
1answer
50 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
214 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
203 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
194 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
78 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
65 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
32 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
80 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
205 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
105 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
122 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
130 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
75 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
61 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
51 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
86 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
104 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
146 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
212 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
79 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
59 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
42 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
32 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
371 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
86 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
71 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
154 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 ...
0
votes
1answer
88 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 ...
0
votes
3answers
89 views

Contact SubType check fail in Smarty TPL file

Have strange issue checking contact type in \templates\CRM\Contact\Form\Contact.tpl This code prints Organization / Society {$contactType} / {$contactSubType} This code prints Organization / ...
5
votes
0answers
61 views

Smarty tokens in postal mailing labels?

Total newbie here, but am I correct in my understanding that Smarty tokens do not function in the postal mailing label template? I have them enabled and can see them working in email and PDF letters, ...
0
votes
2answers
841 views

If statement not working if the smarty variable is not set

I've been trying to figure this out for myself but I am super frustrated at this point! I've got smarty variables and conditional statements working in thank you letters. Well kind of working. ...
5
votes
1answer
965 views

Can I format a smarty token number to have thousands comma?

Based upon smarty documentation I should be able to do something like this {contribution.total_amount|number_format:2:".":","} and get something like 1,234.56, but it shows blank. In the logs I see:...
2
votes
1answer
147 views

Contribution Note Smarty Variable

So I'm super close to getting a smarty variable working to place the contribution note in a thank you letter. I used the API explorer and got this far: {crmAPI var='result' entity='Note' action='...
2
votes
1answer
195 views

How do I use custom Smarty functions in a Form?

The "Extending Smarty" page at http://wiki.civicrm.org/confluence/display/CRMDOC/Extending+Smarty gives instructions for writing custom php functions and calling them from Smarty templates used in ...
6
votes
3answers
905 views

How can I run a php script to display API response with social media information for a contact

OK so I am interested in displaying social media account information for my contacts. Attentiv.ly looks awesome but very expensive :(( So I have been investigating other options and can now ...