Thomas,

Most web toolkits can decorate pages using a site-wide template. These
decorators programmatically intercept pages and transform their contents
-- which is the opposite of the SSI model where each page has to
manually include a snippet of code (e.g. a header). The decorator
pattern is superior to SSI because it produces clearer code, lets you
quickly decorate existing pages, and enables you to make huge changes to
your site layout without having to change each page's SSI/include/etc code.

Good examples of such decorator tools include Rails layout [1][2]; Perl
HTML::Mason autohandler; PHP-Mesh; and Java's SiteMesh, Tiles,
FreeMarker template macros, and others. I haven't used PHP-Mesh yet, but
all the others are excellent.

Although it's possible to build a high-level filter using XSL or a
parser like Hpricot, I have to agree with the others that this could
turn out to be a curse. In most cases, it would be easier and more maintainable to select the decorator tool that best integrates into each app's framework, and maintain a single template per program.

-igal

[1]
http://ap.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html
[2] http://wiki.rubyonrails.org/rails/pages/HowtoWrapViewsWithLayouts


_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby

Reply via email to