Template mechanisms...

Avi Bryant avi at beta4.com
Thu Dec 12 03:05:57 UTC 2002


On Wed, 11 Dec 2002, Stephen Pair wrote:

> For example, I have a widget called RolloverButton (which has a mouse
> rollover effect).  That rollover button can just as easily general html
> indirectly using a DOM approach, or more directly with an SSP approach.
> The important thing is that you have a RolloverButton and use it (and
> other widgets) instead of directly dealing with HTML or an HTML DOM to
> construct your UIs.

Absolutely.  Unfortunately, this is not what people tend to do with
templating systems, because it's not how HTML designers typically work -
instead, they produce one monolithic HTML template per "page".  Once
you're composing tiny widgets instead of using huge templates, how the
HTML is actually specified isn't terribly relevant - but for exactly that
reason, I'd lean towards a DOM approach, because I find smalltalk code
much more tractable than string literals.

The other side of this is that there's no reason not to have a very rough
template with holes for the widgets - if your designer wants to give you
something that's basically a header and a footer, with a few slots saying
"put foo form here" and "put bar button there", I think that's fairly
appropiate.  For this reason, in recent (unreleased) versions of Seaside
I've added #header and #footer (and #style) methods to WAComponent that
are expected to just return string literals - this allows simple
integration of designer-produced HTML (and CSS) while still encouraging a
heavily factored, widget-based style.

Avi




More information about the Squeak-dev mailing list