I'm trying to do some relatively simple math in a template, and I appear to be running into an error. perhaps someone hear can suggest a solution.
... [%- IF top_menu.$base_name != '' -%] [%- page_title = top_menu.$base_name -%] [%- width = (100/(top_menu.$size)); -%] [%- extra = (100-(width*(top_menu.$size))); -%] [%- ELSE -%] ...
This first sample compiles fine .. it has to do with setting up some nice spacing of menu items on a web page, nothing terribly exciting. But ..
gives me the error... [%- IF top_menu.$base_name != '' -%] [%- page_title = top_menu.$base_name -%] [%- width = (100/(top_menu.$size)); -%] [%- extra = ((100-(width*(top_menu.$size)))/2); -%] [%- ELSE -%] ...
file error - parse error - vb-template.tt2 line 31: unexpected token (/2) [% extra = ((100-(width*(top_menu.$size)))/2); %]
I've looked through the man pages, asked on #perl, asked on #tt on irc.perl.org, and I'm now stuck.
Suggestions appreciated.
In reply to Math in Template::Toolkit by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |