[Templates] concatenating strings
Tony Bowden
tony-tt@kasei.com
Sun, 24 Mar 2002 14:34:07 +0000
> > > Is there a directive for concatenating in TT that overrides what Perl
> > > provides?
> > Concatenated: [% var1; var2; var3; %]
> [% x = BLOCK; a; b; c; END %]
> [% y = "$a$b$c" %]
> [% z = a _ b _ c %]
What's the best way of concatenating results of macro calls together
which in turn get passed to another macro?
e.g. given a div_id(id, content) macro which produces an HTML div: [1]
<div id="$id">$content</div>
How do I best produce something along the limes of:
<div id="header">
<div id="left">foo</div>
<div id="right">bar</div>
</div>
Surely I don't actually need a temporary variable?
[% headtext = div_id("left", foo) _ div_id("right", bar) %]
[% div_id("header", headtext) %]
I can't get anything like:
[% div_id("header", div_id("left", foo) _ div_id("right", bar) %]
to work ...
Thanks,
Tony
[1] And, how exactly should I call CGI.div when .div wants to act as a
divide?