On 22 Apr 2001 18:33:45 -0500, Ian Bicking wrote:
> Arkaitz Bitorika <arkaitz@...> wrote:
> > For me the best thing about Webmacro/Velocity is that the template
> > language is at the same time:
> > * Very simple: it has only constructs that are useful for
> > presentation tasks.
> > * Extendable: You can stick any object in the "context" and the
> > template engine will do introspection for you.
> > For example:
> > #foreach ($user in $users)
> > <tr><td>$user.name<td>$user.surname
> > #end
> > This will look for getName() and getSurname in the objects of the
> > $users list. This kind of stuff is _extremely_ useful and clean.
> I'm not convinced. I read those articles, and while they made some
> good points I didn't feel the points made were against the general
> server-page concept. I think they mostly came down to: (a) <>
> characters are cause some problems, (b) server-pages can be misused by
> putting to much code in them (but that's true for anything), (c) Java
> is way to anal and verbose, (d) error messages are poor (which I think
> is mostly an implementation problem), oh and (e) some other details I
> didn't notice.
> So, I'm not sad that I haven't worked with JSP. But, relative to PHP
> I'm not sure about the gain. PHP isn't a great language by any means
> -- but the template languages are just going to make all the same
> mistakes when they get older too. Most of the problems they have with
> server pages is the JSP implementation.
I don't think template languages - webmacro/velocity - are going to make
the same mistakes when they grow up. They have been designed with
clarity and the purpose of describing the _look_ of a model. They
shouldn't evolution to full-fledged programming languages such as PHP or
JSP/Java. Webmacro at least, has been around for a while, and it sticks
to its goals pretty well.
There's a big difference, ones are complete programming languages that
are embeddable in HTML, while others are simply templating tools, with
their associated mini-language, which is "mini" no because they haven't
had time to implement more, but because they don't _want_ to implement
> What I see as the advantage of server pages is that you can
> organically grow the functionality of the website, then start moving
> code elsewhere as it matures or needs to be reused. And it's the same
> language both places, so it's easy to move.
Yeah, but that only works if you and only you can touch the look and
feel of the site. What happens when the web designer wants to tweak your
logic-ridden JSP/PHP page? Or when he has a new design only in HTML not
based in your alien (for him) JSP/PHP code?
> What really makes me cringe is stuff like:
> <% String title = "The Page Title"; %>
> <%@ include file="/header.jsp" %>
> Your content here
> <%@ include file="/footer.jsp" %>
I agree that's really ugly ;-).
> That's not the proper organization -- first, "title" is either (a) a
> global variable, or (b) passed through dynamic scope. Both of these
> are bad engineering.
> And anyway, is it really best for each page to say (and so verbosely)
> what its header and footer should be? This is something that should
> be defined more abstractly.
IMHO the templating system shouldn't define anything more than that. I
like templating systems to be simple and to the point, and then use web
development frameworks such as Turbine or Webware when I need them.
A templating system shouldn't be limited to a certaing header/footer
combination, it shouldn't be limited to HTML either! You can use
templates (at least Webmacro/Velocity) to output e-mail text, RTF, XML
or anything you want.
> Lastly, this is a poor template. It doesn't allow you to define,
> site-wide, any style of what goes in the content area.
> The webmacro alternative they give:
> #set $title = "The Page Title"
> #parse "header.wm"
> Your content here
> #parse "footer.wm"
> Is entirely equivalent, except that it has nicer syntax.