09/04/02 16:20:45, "Mark Mills" <[EMAIL PROTECTED]> wrote:

>Can we see an example? How much of the logic of your system is
>invested in the template code and how much in the rest of the
>system?

OK, the main features of the template engine (which was designed primarily with HTML 
and SQL in mind) are: -

== WYSIWYG focus ==
The templates look very much like their dynamic output and can be edited in a 
commercial HTML editor.
To facilitate this, the engine enforces a distinction between 'tags' (which "do" 
something and look like <!...>-style comments) and interpolable 'glyphs' (which 
"are" something and look like '[[...]]' ).
Our 'tags' seem to be like TT directives, except that they can be introduced by plugin 
extensions. (For instance, one such extension allows generic recursive 
tree structures to be embedded in the template in a WYSIWYG manner using <!recurse> 
... <!/recurse> tags.) 
 
== Context-sensitive quoting ===
Interpolated variables ('glyphs') are automatically quoted in a DWIM manner - in 
certain contexts they are HTML-quoted, in others they are DBI-quoted, and in 
others they are left alone. This is extremely useful in HTML applications which use 
data from an SQL database.

== HTML tag rewriting ==
Template engine subclasses can specify methods for automatically rewriting HTML tags 
(treating them as though they were template tags). This is especially 
useful for form input tags but can also be used to automagically add javascript to 
forms and pages.

== All sorts of automagical SQL stuff ==
The template engine has some useful extensions for updating and reading from SQL 
tables using DBI.


An example template for editing a list of news items stored in a MySQL database is 
attached, for anyone who is interested. This template does not require any 
extra Perl code outside of the template engine to make it a fully functional editor. 

Our problem isn't one of how to convert an existing application or site to work under 
TT. We want to continue to develop sites using our template syntax and 
extensions if possible, because we really like them (and everyone in our company has 
learned them). But we want to improve the template engine. We *could* 
reinvent the wheel, make our engine generate and cache Perl code and do all the other 
neat things TT does. On the other hand, if we can do the same thing 
by hacking TT, we'd obviously rather do that.

Many thanks to everyone who replied to my original post.


Simon McGregor
Title: Edit News

News

Title:
Section: [[:name]]
Body:

Confirm deletion?

Reply via email to