Re: 2 questions

2001-07-09 Thread darren chamberlain

ivan [EMAIL PROTECTED] said something to this effect on 07/09/2001:
 ok I have two questions about TT, let me begin with the
 first one the easier ...

*snip*

 How can in the parent template distinguish between these two
 cases  (if scalar place it, if file include it ).  There is
 third case what if it is scalar-template - then we have to
 parse/process the scalar..

The parent template cannot distinguish between these cases, nor
should it.  The mechanisms for INCLUDING files and echoing strings
are radically different because of how the grammer is written.
Take a look at the Template::Context::include method to see how
and where you can override the behavior of INCLUDE by subclassing
Template::Context.

(darren)

-- 
Nothing worse could happen to one than to be completely understood.
-- Carl Gustav Jung



Re: 2 questions

2001-07-09 Thread Perrin Harkins

 I've sent this email to Template-Toolkit mailing list... but there doesn't
 seem to be anyone, so I'm sending it here ...

Um, you did send it at 6:30PM on a Sunday (yesterday).  Support on that list
is really good, but you can't expect everyone to be on the same schedule as
you.

 How can in the parent template distinguish between these two cases
(if
 scalar place it, if file include it ).

You could handle this with a plugin.  The plugin would determine what kind
of thing $stuff is, and then call the appropriate TT methods to handle it.
In your template you say something like:

[% MY_INCLUDE $stuff %]

 I need a way to replace the web-designer
 inputs,select boxes, textareas with thouse generated from me, but also
want
 to preserve the formating/styles etc.. f.e.

There are basically two ways people do this.  One is to replace the standard
HTML elements with your own, e.g. select size=10 name=foo becomes [%
form.select(size = 10, name = foo) %].  The other is to post-process the
resulting HTML with something like HTML::FillInForm.  That could be done
inside a FILTER block.  If the first appeals to you more, but you don't want
your designers to have to think about it, you could pre-process the
templates to translate the form elements to TT syntax.

There's plenty of documentation for this module that covers the details of
plugins and filters.

- Perrin