On Sun, 8 Jul 2001, ivan wrote:
> How can in the parent template distinguish between these two cases.... (if
> scalar place it, if file include it ).
Um, it can't. Both variables you've mentioned are scalars one contains
text (for a template, and therefore it's a scalar) and the other contains
text (for a filename, and therefore it's a scalar.) However, as a really
quick hack you can obviously do something like
[% IF (stuff.matches(".tpl$")); INCLUDE $stuff; ELSE; stuff %]
that will work in most cases, but it's not really what I'd call an ideal
solution.
Let's see if we can find a nice simple solution instead, that's not
*exactly* what you asked for:
As always, this logic should be extracted out of the template. Why not
instead of putting the filename in 'stuff' put "[% INCLUDE filename %]" in
'stuff'. Then you can do this in your template:
[% stuff | eval %]
which will evaluate the stuff (using the eval filter) and work in your
document for all three cases (plain html, the name of a file - now wrapped
in an [% INCLUDE %] tag, and html with template code inside it.)
Hope that's of some help. I'll leave the form question for another mail.
Later.
Mark.
--
s'' Mark Fowler London.pm Bath.pm
http://www.twoshortplanks.com/ [EMAIL PROTECTED]
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/ +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}