Re: A WM brain bender: DB-based template loader

"marcel.huijkman" <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
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 :-)






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.