Graham
dead Well it is not really meant to go in the twig file you can add the function anywhere on the page or in the text of a link to your guestbook from another page but if you want to then just as described below.
The comment count would have to be assigned to a variable in a xtscript file and so would the guestbook you can then add the xtscript variable name into the twig file and the value would be inserted when the xtscript is processed