talexb has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Math in Template::Toolkit
by kyle (Abbot) on Apr 30, 2007 at 03:43 UTC | |
|
Re: Math in Template::Toolkit
by GrandFather (Saint) on Apr 30, 2007 at 02:48 UTC | |
by talexb (Chancellor) on Apr 30, 2007 at 02:54 UTC | |
by mreece (Friar) on Apr 30, 2007 at 21:14 UTC | |
|
Re: Math in Template::Toolkit
by Herkum (Parson) on Apr 30, 2007 at 12:03 UTC | |
|
Re: Math in Template::Toolkit
by FunkyMonk (Bishop) on Apr 30, 2007 at 20:40 UTC |