Documentation >> Conditionals >> Messages >> Replies >> msg.replies.length
Message Conditional Macro: msg.replies.length
Operators:
- == (equal to)
- != (not equal to)
- greaterThan
- greaterThanOrEqualTo
- lessThan
- lessThanOrEqualTo
Usage Notes
- Tests the length of the list of replies to the current message (in other words, how many replies there are), and compares with the |conditional value| on the right side of the |conditional operator|.
- This conditional only considers the immediate replies to the current message. Replies of replies are not counted. To check the length of the full list of replies, use the |msg.replies.full.length conditional|.
- A simple test to determine whether or not the message has any replies, use this conditional as a |unary macro| (no operator or value).
- One use for this macro would be in a discussion group's message template, where the list of replies and any enclosing HTML would be shown only if the message actually has any replies.
Examples
In this example, the first line will be shown if the message does not have any replies, the second line will show if it has only one reply, and the third line will show if two or more replies have been posted for this message.
<!--#if condition="! msg.replies.length"-->
1. Nobody has replied to this message.
<!--#elseif condition="msg.replies.length == '1'"-->
2. A single reply has been posted to this message.
<!--#else"-->
3. At least two replies have been posted for this message.
<!--#endIf-->
See the above code in action, here:
1. Nobody has replied to this message.
View in DG
|