Hi! Reading some of the recent mails of the Zope mailing lists I wonder how people would think of the following: Imagine writing simple html templates with some custom tags which are quite abstract like <addresslist>. Then write some Python Product (or there might be one Product to make this happen a little simpler) which implements these tags. Advantages: - people without programming knowledge can change the page - you will be able to override existing tags like <a href...>, e.g. to add a session id as additional parameter on every occurence of an <A>-Tag. Also you will be able to automatically fill in <input>-Fields e.g. if you edit some sort of record. - Separate programming logic from layout. Of course you will have to write the tag implementations in Python but actually I see this as advantage.. ;-) I did this before I used Zope with my own classes, called htmlPARSER (http://heimat.de/mrtopf/htmlparser/ ). I was quite happy with it especially with some unpublished additions which made it very easy to write html forms to add/edit/delete records in an sql database. Most of the work was done automatically, you only had to write one form and specify the fields and tables in the database in a simple list (in addition with my mrDBC module (http://heimat.de/mrtopf/mrdbc/). Now I wonder what people on this list think about such things.. :) (as I sooner or later will implement this also in Python. After fiddling around a bit with ZClasses and generating the forms and error handling by hand..) Some more examples: You might define inner template in your html templates: <template name="adritem"> <tr><td><name></td><td><address></td><td><emaillink></td></tr> </template> and then use it in another tag: <addresslist tmpl='adritem'> This would extract some address record (it's up to the implementing function) and for each address record it will use 'adritem' to format it. So you can use the same method with different layouts. It's also important that <name> is local to that template if you want. Thus you can create templates for different lists and nevertheless use a <name>-Tag in every one of them (if it makes sense). More examples you can find in the htmlPARSER-Distribution. -- christian -- COM.lounge http://comlounge.net/ communication & design info@comlounge.net
----- Original Message ----- From: "Christian Scholz" <cs@comlounge.net> To: <zope@zope.org> Sent: Monday, June 19, 2000 3:35 PM Subject: [Zope] html templates?
Imagine writing simple html templates with some custom tags which are quite abstract like <addresslist>. Then write some Python Product (or there might be one Product to make this happen a little simpler) which implements these tags.
Is there an advantage to this over: <dtml-var addresslist> (other than saving a few characters typing dtml-var)? addresslist could be a property or another DTML method... Kevin
Hi!
Imagine writing simple html templates with some custom tags which are quite abstract like <addresslist>. Then write some Python Product (or there might be one Product to make this happen a little simpler) which implements these tags.
Is there an advantage to this over: <dtml-var addresslist> (other than saving a few characters typing dtml-var)?
IMHO it's easier to read and to type and thus more understandable. I used both ways now and I actually prefer the way without a prefix. Some non-technical person might also have problems understanding the meaning.. Also it's not that easy to pass parameters as with tags, e.g. <addresslist tmpl="users" sort=alphabetic> You then need to write the addresslist in some more complicated form (using "" and the stuff). So IMHO it's cleaner with tags. Also the dtml-stuff leads again to using programming inside normal documents. Actually I don't want this. Actually it's then also a security issue. Thus an HTMLDocument or something like this might have the advantage that you can only use predefined tags with predefined functions and these functions are defined somewhere else. You can then easily decide whom you might give the rights to change a function and whom you might give the right to simply change the layout.
addresslist could be a property or another DTML method...
It's more complicated then if you have more than one of these. You would need a dtml method or better a python method for every "tag" you use. This would clatter the directory and make things a little harder to understand. Thus I actually want some python class which implements the tags I need and everything is capsuled fine. Also this class could be derived from some other classes which already give you some functionality like the template stuff or maybe some database<->form interaction (automatic filling of forms with record data and the like). -- christian
On Mon, 19 Jun 2000, Christian Scholz wrote:
Imagine writing simple html templates with some custom tags which are quite abstract like <addresslist>. Then write some Python Product (or there might be one Product to make this happen a little simpler) which implements these tags.
Insofar as I understood your examples, it sounds a lot like what I think you can do with XML in Zope. I'm not sure I really understood your examples, though (nor have I ever *used* the Zope XML support...) --RDM
Hi!
On Mon, 19 Jun 2000, Christian Scholz wrote:
Imagine writing simple html templates with some custom tags which are quite abstract like <addresslist>. Then write some Python Product (or there might be one Product to make this happen a little simpler) which implements these tags.
Insofar as I understood your examples, it sounds a lot like what I think you can do with XML in Zope. I'm not sure I really understood your examples, though (nor have I ever *used* the Zope XML support...)
Thanks for the hint, maybe I look into this if this is what I need :) Still I guess I need to do the database support myself.. ;-) -- christian
participants (3)
-
cs@comlounge.net -
Kevin Dangoor -
R. David Murray