From: marcel.huijkman <mar...@ra...> - 2005-03-15 22:36:50
|
Marc Palmer wrote: > > To address Marcel's complaint about the "abuse" of #include, multiple > databases containing templates would be configured using multiple > delegating template loader definitions, such as db1: and db2: > > However a DB-based template loader could work like the URL template > loading, and include the server and database name etc, with a JDBC > URL. There's no reason not to do this as far as I can see, otherwise > you're saying that http:// or https:// is a bad machanism. > Okay, A DB-based template loader could be handy. However, I advise not to go this way with naming it db: and so on. In a month, a persons stands up, and has an idea to have templates stored in property files, or in xml files or or an ftp server. So it must not be a db: solution, but more generic. It should be a thing you could easily use in your servlet and adapt to whatever happens in the future. Perhaps something like: #include as location1 "$(TEMPLATE_DIR)_includes/init.inc" and location1 as a property in the WebMacro.properties I don't know, but let's think first and then program. Alex Twisleton-Wykeham-Fiennes wrote: >If we follow the #eval method that has been proposed then the inner template >has to magically know that the $templatePath that has been passed to it has >to be treated differently to other normal templates and the code switches >into something like:- > > outer: #set $templatePath = <somethingUnknown> > inner: #if ($Magic.requiresEval($templatePath)) { > #eval $templatePath > } #else { > #include as template "$templatePath" > } > >which to me seems to be a disadvantage. > > This made me think......, perhaps the solution is to handle Magic like Magic, like this: #include as magic "$templatePath" I got your point, however I could imagine that a person recieving a template from somewhere and don't know from where it came, could easily be confused. But let's assume that is certainly not my problem. As I positifly said before, think first, than act. And my idea's are free, but may be used by others :-) |