> ShoppingCart
>      |__________Item1
>                   |_____price = 100
>                   |_____qty = 3
>                   |_____ext_price = "ShoppingCart.Item1.price 
> * ShoppingCart.Item1.qty"
> 
> I really don't want to have to refer to price and qty with 
> "absolute paths" like that.  I'd much prefer something like:
> 
>       ext_price = "..price * ..qty"
> 
> or whatever syntax I eventually settle on.  But the point is, 
> turning "..price" into "ShoppingCart.Item1.price" is 
> trivial *if* I happen to know that I'm currently "on" 
> ShoppingCart.Item1.ext_price.
> 
> Does any of that make sense? is there a whole better way that 
> I'm just not seeing?

Can't you just do this with local variables?

[% FOREACH item IN cart.items %]
   [% price = item.price; qty = item.qty %]
   ...
   [% ext_price = price * qty %]
   ...
[% END %]


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to