[Prev][Next][Index][Thread]

[OFF] HTML template languages



So what do others think?

I just made a crack about the ugliness of "JavaScript and similar
approaches
where HTML contains a tag that contains a script that "prints" HTML out
as a side effect" as part of a longer rant. I'm not fond of any form of
"program" that "prints" out HTML, whether Perl or Python or Tcl. And I
consider nesting that within HTML itself horrible.

Here's a real-life example of my preferred approach:

<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
	<TR><TH COLSPAN=4 ALIGN=CENTER>Pagers: <!--Count([Pagers])-->
found</TH></TR>
	<TR>
		<TH>Name</TH>
		<TH>Dept</TH>
		<TH>Phone</TH>
		<TH>Pager</TH>
	</TR>
	<!--ForEach([Pagers])--><TR VALIGN=TOP>
		<TD><!--[Pagers]Name;ln--></TD>
		<TD><!--[Pagers]Dept;ln--></TD>
		<TD><!--[Pagers]Phone;l--></TD>
		<TD ALIGN=CENTER>
			<!--If([Pagers]CanPage)-->
				<A HREF="editmsg.4ds?[Pagers]Num=<!--[Pagers]Num-->">
			<!--/If([Pagers]CanPage)-->
			<!--[Pagers]Num;l-->
			<!--If([Pagers]CanPage)-->
				</A>
			<!--/If([Pagers]CanPage)-->
		</TD>
	</TR><!--/ForEach([Pagers])-->
</TABLE>

A couple of notes:

I put my tags in HTML comments because I was a newbie to this and was
trying to come up with the form that would be least objectionable to
HTML verifiers and WYSIWYG editors. This was a complete failure and I've
since figured out that I shouldn't have even tried.

The [table]column syntax rather than the more common table.column just
mirrors the underlying database/4GL syntax. What follows the ; are
formatting options.

One product whose approach I actually like is at http://www.heitml.com/.
In essence, what I envision is rather like HeiTML but with Dylan syntax
for the language and with templates preprocessed and compiled per Bruce
Hoult's comments.



Follow-Ups: