10 votes
Accepted

How to deal with ' or (') in CKeditor

You can turn off html encoding for CKeditor through UI (i.e >= 4.7) Navigate to Administer >> Customize Data and Screens >> Display preferences Scroll down until you see Configure CkEditor button. ...
Pradeep Nayak's user avatar
10 votes

How can I change the date format in a Search Kit result?

You must be on CiviCRM 5.47+ to have the "Use Smarty in Search Kit rewrites" feature. Create a Search Display based on your search - e.g. Add » Table using the Add button in the left pane. ...
Jon G - Megaphone Tech's user avatar
7 votes
Accepted

SMARTY error with template

The styling needs to be wrapped in {literal}...{/literal} in the message template.
Demerit's user avatar
  • 22.9k
7 votes
Accepted

Message templates token replacement: is it {if membership_end_date} or {if {membership_end_date}}?

It should be {if '{membership.end_date}'} and {membership.end_date|crmDate}
Pradeep Nayak's user avatar
6 votes
Accepted

How can I see the available tokens for message templates?

use {debug output=html} To have a nice formatting in html email
empiguet's user avatar
  • 158
6 votes
Accepted

How to set a id attribute to button?

I believe you cannot set id to a button using php however you can define your own class for the button and use JS to set the id for that class. Here is the snippet to add class for button $this->...
Pradeep Nayak's user avatar
5 votes
Accepted

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

Rather than smarty, JavaScript will do the trick. Those tabs are all separate pages, and you can load any CiviCRM page/form as a snippet instead. First, in your extension, use a hook to include the ...
Andie Hunt's user avatar
  • 7,452
5 votes
Accepted

Custom date field formatting with smarty

Found the answer. The civi field token must be captured to a Smarty variable first: {capture assign=arr}{contact.custom_105}{/capture}{$arr|date_format:"%A, %B %e, %Y"}
Phil Morice Brubaker's user avatar
5 votes

How to use Smarty for change greetings for French?

Try below code {capture assign=contact_gender}{contact.gender}{/capture} {if $contact_gender eq 'Female'} Chère {$first_name|default:Friend}, {/if} or {capture assign=contact_gender}{contact....
Pradeep Nayak's user avatar
5 votes
Accepted

Displaying custom contribution field in the online receipt

The smarty variables for online and offline may be different for Contribution ID. For offline {crmAPI var='rname' entity='Contribution' action='getvalue' return="custom_134" id=`$...
Pradeep Nayak's user avatar
4 votes
Accepted

Override TPL path dynamically

Use an extension's templates dir Creating a simple extension via civix provides a templates/ directory in the extension. This is searched before the default templates, so you can intercept and ...
Chris Burgess's user avatar
4 votes
Accepted

If statement involving "is not empty" in smarty template?

{capture assign=temp}{contact.supplemental_address_1}{/capture} {if $temp ne ""} {$temp} {/if} is what I do. I got the idea from the source referenced above. You also need to ensure that smarty is ...
Mick Kahn's user avatar
  • 3,227
4 votes
Accepted

Custom Email Greeting token doesn't work

Any chance you don't have smarty enabled for civiMail so your capture-assigns and ifs aren't working in the mail? Try checking your civicrm.settings.php file and look for the line define( '...
Eli Lisseck's user avatar
  • 1,499
4 votes

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

Don't think you have a direct variable to use in the template. Worth trying an extension to provide this? It can be done by simply writing something like below in your hook. function ...
jitendra - fuzion's user avatar
4 votes

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

You can use CiviCRM api through smarty to retrieve if membership is active for a contact. You can achieve this by Turn on CIVICRM_MAIL_SMARTY (set to TRUE or 1) in civicrm.settings.php add below api ...
Pradeep Nayak's user avatar
4 votes
Accepted

How to use Smarty for change greetings for French?

Thanks to Pradeep's help I found the way: For my case, this is the code to use {capture assign=gender}{contact.gender}{/capture} {if $gender eq 'Homme'} Cher {contact.first_name}, {elseif $gender ...
Guillaume Sorel's user avatar
4 votes
Accepted

Smarty only generating nulls from API calls

So, for posterity's sake, I wanted to share the answer I figured out. When I looked at the Source view of the email in CiviCRM, I realized that the code had pasted as <p>id:&nbsp;{contact....
pyfi's user avatar
  • 81
4 votes
Accepted

Insert file into greeting field with Smarty

The length limit of the greetings syntax can be quite tricky, especially when using different languages with gender specific greetings. Luckily there is the extension More Greetings that provides ...
Fabian's user avatar
  • 3,557
4 votes

Smarty syntax error: unrecognized tag?

Nevermind. I've looked through all of the settings, and it turns out that my colleagues modified the Addresses format but didn't do it correctly. Once this is fixed, everything is back to normal now....
Aaron's user avatar
  • 71
3 votes
Accepted

Smarty code not working

The problem is that the space in the if-statement is &nbsp; rather than a normal space. For this reason, it's worth writing your smarty statements while viewing the Source code in the template ...
Phil Morice Brubaker's user avatar
3 votes

Smarty Template CMS-agnostic URL

{crmURL p="civicrm/points/grant" q="cid=$cid&type=$type"} ^this The p is the address of the page The q is the list of parameters The domain is added first So the above code (with $cid=A and $...
JohnFF's user avatar
  • 2,343
3 votes
Accepted

Smarty and future proof code

Going forward, much of the Civi UI will be written in Angular. However at least 95% of the application uses Smarty and it's still a perfectly acceptable way to mark up a form or page. Depending on ...
Coleman's user avatar
  • 18.6k
3 votes

Scheduled Reminder Email is Empty

For anyone who may face this issue, it was finally fixed by WP Engine through adding an exception on the firewall for CiviCRM cron URL.
Soroush Zo's user avatar
3 votes
Accepted

$participant_status_id shows previous value in email template

This was posted a while ago, but I thought I should post the solution I finally found to the problem (which still exists in my version 4.7.29 install) The solution to this problem was an API call. ...
Jeff Wood's user avatar
  • 133
3 votes
Accepted

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

It doesn't work because $lineItem is not set in the template, you'll have to loop thorough $contribtuions and use the API: {foreach from=$contributions item=contribution} {crmAPI var='result' entity='...
Andrei's user avatar
  • 2,321
3 votes

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

You will need to turn on CIVICRM_MAIL_SMARTY in civicrm.settings.php to use smarty templating for conditional and more complex logic. Cheers Pradeep
Pradeep Nayak's user avatar
3 votes
Accepted

How to include smarty script with mosaico email

As a workaround for the specific example in your post, you can create a custom token. This post explains how using hook_civicrm_tokens and hook_civicrm_tokenValues
Aidan's user avatar
  • 13.5k
3 votes
Accepted

Issue with sending html email from civicrm with Smarty

It might be because you have syntax error in your smarty code. Try not to use editor if you want to use smarty code or use this configuration to use smarty using ck-editor
Pradeep Nayak's user avatar
3 votes
Accepted

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

Welcome to CiviCRM SE KLeeHK! I am not sure if you can suppress the translation of particular Smarty tags e.g. {$receive_date} or change the date format of only this occurence. The receipts can be ...
Fabian's user avatar
  • 3,557
3 votes
Accepted

Thank-you letter incorrect contribution currency

Well - there's a bug worth reporting here, but I understand your priority is getting these letters out. This should do the trick: Go to Administer menu » Localizations » Languages, Currency, ...
Jon G - Megaphone Tech's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible