Danny Lee wrote:
Hi guys,
Let's imagine that I'm building a web store and have a lot of different
product groups.
For every product group I have a template describing how to peresent the
products in this group.
My web store have to be cool, so there is an admin interface, where the
admin can create new product groups. So he can also define custom
templates for presentation of these groups.
The question is how to put custom DB-stored templates with some data?
The only way I could think in the moment is creating some crazy bean,
which mixes the stuff together and generates some output, but I have a
feeling this may be quite difficult and also quite slow solution, as
long this mechanism have to be started for each product/product list
presentation.
Well, I supose I'm not the first poor guy having this problem, so any
tips and suggestions are welcome :)
cheers
Danny
So essentially what you want to do is take template text from a database
and implement some component capable of rendering that template against
data from your application.
There are an awfully large number of technologies out there that you
could use to achieve this. It's difficult to recommend any one
technology without knowing more about your needs and requirements. For
example, since templates should be created/editted by administrators you
presumably care about what the template language/syntax looks like. You
may need to pass simple sets of data into your templates or you may need
them to be able to accept and address arbitrarily complex data
structures. You may need templates to be highly efficient to render or
you may be prepared to accept some compromises here in favour of making
them easier to work with. Etc.
Without knowing more about your needs, I'd suggest looking at something
like Velocity or WebMacro, frameworks that provide a simple but powerful
template language that's easy to integrate / call into; or BSF which
would allow you to support templates written in any of a number of
programming languages (Java, Python, Java, etc.) if you need more
powerful templates.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]