XF 1.2 How do I use xen:calc and xen:number together in a template?

Stuart Wright

Well-known member
Hi folks,
so we have
title="{xen:calc '{$block.reply_count}+1'} Comment<xen:if is="{xen:calc '{$block.reply_count}+1'}!=1">s</xen:if>"
that number is occasionally more than 1,000 and I want to use xen:number on it to format the number properly with a comma.
How do I use both please? (I tried a few combinations which gave template save errors).

Stuart Wright

Well-known member
Silly me, I found the answer. It's simple and I must have misstyped it first time:
title="{xen:number {xen:calc '{$block.reply_count}+1'}}} Comment<xen:if is="{xen:calc '{$block.reply_count}+1'}!=1">s</xen:if>"
I think I missed an ending squiggly bracket.
Anyway, hopefully useful for those people who are searching for the same answer.


XenForo developer
Staff member
BTW, in your if tag, you don't even need the calculation - subtract 1 from each size. You're just checking if there if reply_count != 0.