Sometimes, especially in e-mail messages, you will want to format a message with aligned columns. Consider this example:
[CycleEach Player SortBy PlayerName]
[Player.Alias] <[Player.EMail]>
[EndCycle]
This could have the output in an e-mail message be:
Red Troll <red.troll@sharenet.com>
Black Troll <black.troll@sharenet.com>
What would be nice, is to allow these columns to be aligned and formatted properly. This can be done by appending a "colon modifier" to the very end of the variable name. Several of the default e-mail templates installed with AutoTroll use these. Consider this example:
[CycleEach Player SortBy PlayerName]
[Player.Alias:15] <[Player.EMail:30]>
[EndCycle]
This modified template would display:
Red Troll <red.troll@sharenet.com>
Black Troll <black.troll@sharenet.com>
This modifier works both to expand or pad the displayed variables as in the above example, but also will shrink or clip variables like this :
[CycleEach Player SortBy PlayerName]
[Player.Alias:15] <[Player.EMail:30]> Use Shadow Email : [Player.UseEMail2:1]
[EndCycle]
Instead of showing the default "Yes" for using the shadow e-mail, this template would now display:
Red Troll red.troll@sharenet.com Use Shadow EMail : Y
Black Troll black.troll@sharenet.com Use Shadow EMail : N
In general, you can use these colon or display modifiers on any variable to expand or clip them as you see fit for your formatting.
WebTroll Users!
There's also a "u" modifier. This is especially for formatting a variable so it is suitable to be displayed in a URL. For example, if you want to pass the player's name to a CGI/WebTroll program, you might have something like this in your web template:
Spaces are illegal in a URL, so the ":u" modifier to any template variable allows you to pass the variable - even if it's a string variable - to a CGI program like WebTroll. AT will change "Auto Troll" to "Auto%20Troll" - which is a valid string.
Producing Plain Text Files from Web Templates
Web templates typically produce output for web pages so spaces are converted to . Sometimes you might want a plain text file produced, but without all these special web characters. In your web template place a [NoHTML] tag and this will turn off HTML encoding and produce plain text (like e-mail templates). With a SaveAs command the file will still be saved in your FTP directory and uploaded to your website, but you can protect the directory these are kept in.
This allows you to create custom 'reports' that you can access locally on AT server machine, or simple TEXT files you can access/download from your website. It's also a greate way to debug/develop new templates to get everything just right before adding all the HTML and formatting text.
The advantage of templates in the web templates folder is they get re-run after any data changes in AT, so you're sure to get the most up to date reports/data from your templates. This is why your website is always up to date. See Web Templates for more information