15/04/02 11:18:53, Andy Wardley <[EMAIL PROTECTED]> wrote:

>On Tue, Apr 09, 2002 at 10:06:47PM +0100, Simon McGregor wrote:
>> We really like HTML rewriting, because it makes our templates very WYSIWYG.
>[...]
>> How do other people do automagic HTML rewriting under TT?
>
>You can use the XML::Style plugin.

You do know that the CPAN links to the various Template modules and their
documentation are down?
(Perhaps this is a result of your domain name problems.)
I guess my version of TT must be out of date, as I had to browse tt2.org
downloads to find the plugin.

The plugin as it stands doesn't quite do what I wanted so I'll try a slightly
different approach.
What I could really do with is a "METAFILTER" directive which allows me to work
on the raw TT template code enclosed in a block. For instance, I want to be able
to turn

[% FOREACH item=some_dbi_query %]
  Name: <input type="text" name="name" tied="item.name"><br>
  Text: <textarea name="text" tied="item.text">Insert Text Here</textarea>
  [% do some arbitrary processing %]
  <!-- ... -->
  <input type="submit" value="Update Item" auto_generate_image name="UPDATE">
  <!-- replace this input with an input type="image" if our system supports
auto-generated buttons -->
[% END %] <!-- END FOREACH -->

into

<!-- RAW [% FOREACH ... ] CODE HAS BEEN PRESERVED -->
[% FOREACH item=some_dbi_query %] 
  Name: [% replace_input(type=>"text", name=>"name", tied=>"item.name") %]<br>
  Text: [% FILTER replace_textarea(name="text" tied="item.text")]Insert Text
Here[% END %]
  <!-- RAW [% do some arbitrary processing %] CODE HAS BEEN PRESERVED -->
  [% do some arbitrary processing %]  
  <!-- ... -->
  [% replace_input(type=>"submit", value=>"Update Item",
auto_generate_image=>"", name=>"UPDATE") %]
  <!-- replace this input with an input type="image" if our system supports
auto-generated buttons -->
<!-- RAW [% END %] CODE HAS BEEN PRESERVED -->
[% END %] <!-- END FOREACH --> 

using a 'METAFILTER' or some such (ideally at compile time!)... is this
feasible?

Many thanks.


Simon McGregor



Reply via email to