For a page in the browser, we can put &smartyDebug=1 in the URL to see variables in scope for the top level template. How can we do this for message templates?
3 Answers
Insert {debug} into a message template then perform the relevant action (ie make an online contribution if you modified Contributions - Receipt (on-line)). The email sent will contain a list of all the smarty variables assigned to that template
-
A limitation of this approach is that it doesn't work for all templates. For instance, in 4.6.2 I can make this work on emails sent from a Contact screen, for a Contribution email ... but NOT for an activity reminder email. In fact, I'm not even sure Smarty is active for the reminder emails? Commented May 15, 2015 at 5:08
-
2When I inserted {debug} in the message template, the debug information was showing only in the headers of the email (viewable only when you click "View Source" or equivalent). So I copied that debug information from there, pasted it into Notepad++ and saved it as an HTML file. I had to remove the javascript surrounding the html. I also replaced all instances of
\/
with/
. Now when I loaded the HTML file in my browser, I had a READABLE debug information, showing me all the smarty variables available to me. Commented Nov 20, 2015 at 14:48 -
2Also, I was modifying the Contributions - Receipt (on-line) message template but I didn't want to go through submitting the whole donation form just to check whether my changes looked good. So I went to Find Contributions, then selected one of the contributions I had already made and from the Actions dropdown at the top, I chose Print or Email Contribution Receipt. This way I could quickly make small changes to the template and see if I achieved what I wanted. Commented Nov 20, 2015 at 14:54
You can insert the {debug}
Smarty token into your template: http://forum.civicrm.org/index.php/topic,14845.msg63471.html#msg63471