Using Tokens and Conditional Text means a single Template/Stationery can be created that applies to all reservations. The goal is that no editing of an email letter should be required, in normal circumstances, to sent it to a guest.
Tokens are text in a Template or Stationery that get replaced by something else when the Template/Stationery is used. An example token would be [[GuestFirstName]] that would be replaced by a guest's first name as it is defined in the Reservation->Guest tab. Whenever this token appears in the Template/Stationery it will be replaced by the appropriate reservation guest's first name. Tokens are NOT case-sensitive but are usually displayed with capitalization to make them easier to read.
When on the Setup->Templates or Setup->Stationery pages, look to the top-right of the page under the menu bar for the column titled Tokens. Click on Tokens if it does not show sections underneath starting with "Reservation Info".
Click on any of the sections above the Directions block to see it open up and give a list of tokens that are available under that section. Place your mouse cursor over the list items to see a description of the token and its usage.
A Token may allow you to add a Modifier to change or control the way the information is displayed. These modifiers are added after the ":" and before the closing "]]". See the mouse-over descriptions in the tokens list for the modifiers that can be used for each Token.
Modifier Example: in one letter you may want an address displayed on a single line with commas separating each part of it, but in another letter you want it in the form used to write on an envelope. The tokens that produce addresses and lists allow you to specify the "separator" used between these items. You can write:
Sometimes it is desirable to use certain text in one set of circumstances and different text in another.
For example, in quotations if there are no quotes (because of unavailability perhaps) then it may still be desirable to send an email saying that the dates are not available but take a look at our website for other dates when the inquiry is a direct one. There are different texts depending on whether there are any quotes and this can be written in a single Template. The Predefined Quote template makes extensive use of Conditional Text to produce a sensible email response.
The system uses simple directives amongst the text, each directive on its own line and the first character on the line must be a '#'. When editing Templates/Stationery that contain Conditional Text ensure that each of the directives stays on its own line for it to continue to work correctly. If you use a WYSIWYG editor then often these will reformat the text and the Conditional Text will not work any more. For this reason it is strongly recommended that a WYSIWYG editor is NOT used - use an HTML or Plain Text edit instead.
Directive syntax using Perl Regular Expressions:
if: ^\s*#\s*if\s+(.*) - the () contains the condition
else: ^\s*#\s*else
endif: ^\s*#\s*endif
Examples:
#if <condition>
<Text to include if condition is true>
#endif
or for alternatives use else:
#if <condition>
<Text to include if condition is true>
#else :: this is a comment
<Text to include if condition is false>
#endif
The if/else/endif directives can be nested:
#if <condition1>
<Text to include if condition1 is true>
# if <condition2>
<Text to include if condition2 is true>
# else :: this is an end-of-line comment
<Text to include if condition2 is false>
# endif
#endif
The condition can be a combination of expressions that are associated with logical "and" or logical "or". The expressions would normally include at least one Token so that the condition may change.
Condition Syntax:
expr1 [[LOP expr2 [LOP expr3]...]
where:
exprN is an expression,
LOP is a Logical Operator - either && for Logical AND or || for Logical OR
[items] are optional
Expression Syntax:
val1 [COP val2]
where:
valN is a value, a calculation or a Token the evaluates to a value,
COP is a Comparison Operator - such as ==, !==, ===, !==, <, <=, >, >=
[items] are optional
Comparison Operators:
Condition Examples:
Currency amounts: By default a Token that is substituted with a currency amount is formatted with a comma to separate the thousands. This is the most common use of such tokens. When comparing currency amounts the comma should be removed and can be done so my appending the "raw" Modifier, eg: [[OutstandingAmount:raw]]
TBD
Recent comments
30 weeks 5 days ago
30 weeks 6 days ago
33 weeks 5 days ago
33 weeks 6 days ago