Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [smarty]

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

1
vote
0answers
41 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
38 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
33 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
22 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
64 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
89 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
49 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
181 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 ...
3
votes
2answers
198 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
179 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 ...
1
vote
1answer
61 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
60 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
31 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
74 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
192 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
808 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}
3
votes
1answer
91 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
108 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
126 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
72 views

Smarty Template CMS-agnostic URL

Please can someone remind me how to create a CMS-safe URL in Smarty Templates? Thanks
3
votes
1answer
46 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
50 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
78 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 ...
5
votes
2answers
98 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
144 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 ...
3
votes
2answers
208 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
78 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
54 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
41 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
30 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, ...
3
votes
2answers
340 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
83 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
70 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
144 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
87 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
81 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
60 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
726 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. ...
4
votes
1answer
869 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
146 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
183 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
827 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 ...
2
votes
1answer
507 views

How to get php $_SESSION variable inside a template

I am setting $_SESSION variable inside a payment response file and need this to display on Thank you page. Somehow nothing seems to work so far. Tried following things: $_SESSION['test'] = 'Hello ...
2
votes
2answers
980 views

How do I pass a variable to a smarty template?

Big picture: I'm working on a module that will display view-only custom data on a specific contribution page. Please understand, if you're not aware of this already, view-only custom data is not ...
6
votes
3answers
595 views

Escaping quotes in ckeditor breaks smarty-syntax

The ckeditor has the habit to escape characters like quotes or umlauts. This breaks the smarty-syntax when generating PDFs or mails. Is there a good work-around or solution?
3
votes
2answers
157 views

What hook(s) can modify variables passed into Smarty templates?

Recently I needed to modify Smarty variables being passed into a template from an extension. I tried a couple of likely hooks, but neither of them seemed to provide this functionality. The templates ...
1
vote
2answers
49 views

Mail not working url for third party app

I’m doing a basic automation with scheduled reminders: I want to send a survey to every one where a certain activity is completed. For the survey I use a nice third party app: surveypal.com. As I want ...
0
votes
1answer
88 views

How can I preserve smarty date formating in message templates?

I have a message template that we use to print letters for those joining our association. We want to include the end date for their memberships in the letter (This used to be printed on membership ...