Forum OpenACS Q&A: Answer to: "For those who have worked with ACS 4 Templating, what was it like?"

Stephen, since you ask:
FWIW, I think Karl's design for ACS4 templating was pretty close to ideal. But that's an armchair analysis, not one from experience. For those who have worked with it, what was it like?

Well, I've had moderate experience using the ACS 4 templating system, and it is fine. Quite useful, and really fairly simple.

At one point, I dug into how it actually worked, as I had a registered filter doing some special-purpose access control checking across thousands of URLs, which needed to tie into the templating system in order to serve nicely templated "acess denied" pages and the like. Hm, here, I saved a code snippet - I ended up doing something like this:

# These all give the correct absolute unix pathname to the
# denied-access template:

#set file_root "[ns_info pageroot]/../templates/denied-access"
#set file_root "[get_server_root]/templates/denied-access"
set file_root [template::util::url_to_file {/templates/denied-access}]

set args [list title $title context_bar $context_bar page_content $page]
set output [template::adp_parse $file_root $args]
ns_return 403 text/html $output

When I was digging into the templating code in order to really understand how to do the above, my feeling was that the code could have been somewhat better commented, and that the piece that does the walking up and down the tree of included master templates could probably have been made more general - I seem to vaguely remember that, as written, it works only for the usual case where you start off with a *.tcl / *.adp pair in the file-system - not when you call into the templating system procs from some Tcl code that you're writing, like I was doing in the example above.

But those are trivial quibbles, irrelevent to probably 99.9% of the uses to which the templating system is put. So basically, I don't know 'nothin about XML or XSLT, but the ACS 4 templating system struck me as an excellent tool.

Oh yeah, and back when I still worked at aD, I remember hearing one of the aD London developers talk about the graphical-design process used on one their client projects. Apparently, the client's graphic designers all used some fancy Mac-based HTML editor which has hoooks of some sort for foreign (non-HTML) tags.

So somebody (one of the aD developers, I believe), wrote some stuff for those hooks which accomplished two things: One, the Mac program now "knew about" the templating system tags and would not bash them up when editing .adp files. And two, these hooks would insert fake stub data, so for example the <multiple> tag would show with five rows of bogus data, to give the graphic designers an idea of how the final product would look when like and database-backed.

From what I heard, this was a wildly successfull example of separating the graphic design from the programming - frequently a source of great friction on web projects. And these graphic designers loved it too - not just the programmers.