Better Message Templates
ties into the existing message template administration UI and is accessed as typical; e.g. Mailings > Message Templates
or Administer > CiviMail > Message Templates
.
Make this the default tab - make Better Message Templates
the first, default tab. Not available when using the Message Administration
extension.
The template select control lists all the User-driven and System Workflow message templates available. Selecting a User-driven message will open in the OG CiviCRM WYSIWYG editor. Selecting a System Workflow message will open in the Better Message Templates
editor.
The important templates are listed in green and indicate their modified status, number of samples available, and translation/drafts available.
Only list important templates - hide System Workflow templates that aren't important.
The search field above the template select control allows you to search all message template content. The template select control updates to include only those templates that match the search.
Global Settings apply to all users across all browsers on all devices. Changes are saved immediately.
<!-- BEGIN HEADER -->
and <!-- END HEADER -->
comments with the {header}
token for the selected header component, for HTML content. For plain-text, the {header}
token is placed before all other content.
{footer}
token for the selected footer component before </body>
, for HTML content. For plain-text, the {footer}
token is placed after all other content.
Better Message Templates
defines {header}
and {footer}
tokens for all active header/footer mailing components (Administer > CiviMail > Headers, Footers, and Automated Messages
). These tokens can be used wherever tokens are available, and should appear on Tokens dropdowns found in the various user interfaces. Headers and footers can contain other tokens, and these will be processed as well, in the context of the containing document being rendered/sent. As a result, some tokens may not be rendered properly; e.g. an {action.whatever}
token requires a mailingId
, which would not be applicable for a system workflow message.
Personal Preferences are stored in browser local storage immediately. They will not persist to another browser on the same device, or any broswer on any other device.
Better Message Templates
the first, default tab. Not available when using the Message Administration
extension.
Better Message Templates
editor into maximized mode when opened, explained in more detail to follow.
Better Message Templates
editor to standard size for the theme.
[in evaluated template line #]
, where # is the line number containing the error.
The Better Message Templates
editor is comprised of a title bar, the Sample pane, the Message pane, and the Tool pane.
The editor is shown here in it's maximized state. Click the Maximize () icon to ignore the theme and resize to fit the entire browser viewport, obscuring all other site content including things like fixed headers/footers and site navigation. The border around the browser viewport will be green if the current message template has not been modified, and will turn red once a change has been made.
Click the Restore Theme icon () to restore the editor to standard size for the theme.
Click the Close icon () to close the Bette Message Templates
editor and return to the template listing.
Each system workflow starts with a single, Standard, variant. A language variant may be added...
The variant selector is depicted open for demonstration purposes only. You do not need to do that in order to use these actions.
Activating a draft copies it's current contents into it's counterpart, and switches to it. e.g. French (Canada) (Draft)
gets copied into French (Canada)
. French (Canada) (Draft)
will not be deleted, and French (Canada)
will not be saved; you must take those actions seperately.
A modified variant is listed in red.
The red border around the editor (maximized mode only) and the Save Template action will revert to their normal state once all modified variants have been saved.
The editor context (right-click) menu has a few commonly used actions, including three added by Better Message Templates
, and provides access to the Command Palette.
The structure of a template can get confusing at times. The location of the mouse pointer within that structure is shown below the Outline.
Clicking a variable or token in the Outline will select it and all other references to it. Click X of Y to scroll the next reference into view.
The variable or token is also selected in the Sample pane, depicted in more detail later in this tour.
Shift click a section of content in the Outline to expand that selection to include sibling content.
Ctrl click a section of content in the Outline to expand the selection even further to include the opening and closing Smarty tags for the parent block.
Text that has been removed since the selected revision is shown in red; click to restore. Text that has been added since the selected revision is shown in green; click to remove.
Use the X of Y to scroll through the differences.
When a sample is not selected, the Variables list simply helps with navigation, by selecting all references to it in the Outline.
The sample dropdown lists your 25 most Recent Captures
and as many Reference Samples
as you choose to create (more below).
After selecting a sample, the Variables list is updated to include any variables and tokens that were included in the sample but not referenced by the current template.
Setting/changing a value for a variable is not required, but can be helpful to see how it affects the output of the template, or for anonymizing data for reference samples.
You won't see this type set for a variable unless you choose to use it. It's provided mainly to help document the meaning/source of certain variables in reference samples. Again, totally optional.
Rename a variable or token across HTML, Plain-text, and Subject formats in one go. Can be quite helpful when a variable gets deprectated/removed.
Deselects the variable in the Variables list, hides the editor if a sample is selected, and clears the variable selection in the Outline.
When the last reference to a variable is removed from the template text, it will still appear on the Variables list. Use this to rescan the template text and remove unreferenced variables.
The new sample will be a copy of the currently selected sample. While you can create a new sample without one already selected, doing so will create an empty sample with no values assigned to any variables; you're not likely to find this too useful.
Saving a sample updates the currently selected sample. If the currently selected sample is a Recent Capture
, those changes will be lost along with the sample when it is no longer 25 most recent.
Saving a sample with a different name will change a Recent Capture
into a Reference Sample
, which will remain available until you choose to delete it.
Having recent captures is a good way to keep up with message templates, as they will include changes that may be made in core CiviCRM code; e.g. when getting converted to use tokens in place of template variables. However, your recent captures might not include all the scenarios that the template might need to cover. Creating reference samples solves for this.
Before creating reference samples, you should first create a perfect sample contact. This contact should have an obviously not real name, and provide values for every bit of data you ask from your constituents; imagine someone with zero privacy concerns giving you every bit of information you ask for. Make that contact. When it comes to addresses, provide real city/state/province/postal values but maybe make up a street name. Make sure phone numbers aren't connected to a real person, (999)555-1212 as a U.S. example. Etc.
To create a reference sample for a template execute that workflow as your sample contact, which will result in a recent capture. Then use Save Sample As...
to give it a meaningful name. Rinse and repeat as necessary for the template; e.g. a contribution page that accepts credit card, PayPal, and pay later, would ideally have a reference sample for each of those options.
Rinse and repeat for each message template used by your organization.
CiviCRM occasionally makes changes to message templates, so it's possible that your reference samples may become unusable. In the rare instance that this happens, you should delete and recreate your reference samples.