[Zope] Fwd: Re: [Zope] html templates?

2000-06-20 Thread Curtis Maloney



--  Forwarded Message  --
Subject: Re: [Zope] html templates?
Date: Tue, 20 Jun 2000 16:51:17 +0200
From: [EMAIL PROTECTED] (Christian Scholz)
To: Curtis Maloney <[EMAIL PROTECTED]>


Hi!

On Tue, Jun 20, 2000 at 11:50:03AM +1000, Curtis Maloney wrote:
> On Tue, 20 Jun 2000, Christian Scholz wrote:
> > 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 . Then write some Python Product (or
> > there might be one Product to make this happen a little simpler) which
> > implements these tags.
>
> Well.. funny you should mention this.
>
> I have been implementing just such a thing for our company web site
> (currently being zopified :)

Well, I've also done such a thing before as said in my mail, just not
with Zope.. ;-)

> It uses XML, but also allows you to fall back to HTML (so long as it's XML
> compliant... easy to do).

Well, this shouldn't be a difference also in my system..

> After recent discussions with my Zope mentor, I am going to try to
> reconstruct the whole thing to allow local tag sets to be specified in each
> document.

Well, I have these in my templates.. Thus I can use  in different
contests.

> > - Separate programming logic from layout.
>
> Erm... wasn't that one of the primary designs of HTML? (o8

Hm, no, it was separating the visual represenation from the logical
structure. That's what XML is now good for (and better working as no
browser has predefined visual elements for xml tags and of course
as xml tags are not predefined..)

> > Of course you will have to write the tag implementations in Python but
> > actually I see this as advantage.. ;-)
>
> Ermm.. no.. I've done all of mine in DTML.

Maybe both should then be possible. But I actually like to use
a real programming language.. Some things are quite difficult
to do in DTML. The only problem was before that for writing products
you needed to restart Zope all the time but with the Refresh Product
this is not needed anymore..

> > (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..)
>
> Hmm... well, once I've had time to put some more work on this, I'll be
> happy to send you my code...

And I can send you mine when I've done it.. Maybe it's only porting
htmlPARSER to Zope.. We'll see.. :)

Nice to hear that someone else is also interested :)

greetings!

Christian

PS: Maybe you should also send your reply to the Zope list to find
some more interested people.. ;-)

--
COM.lounge  http://comlounge.net/
communication & design [EMAIL PROTECTED]

---

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] html templates?

2000-06-19 Thread Christian Scholz

Hi!

> On Mon, 19 Jun 2000, Christian Scholz wrote:
> > Imagine writing simple html templates with some custom tags which are quite
> > abstract like . 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


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] html templates?

2000-06-19 Thread Christian Scholz

Hi!

> > Imagine writing simple html templates with some custom tags which are
> quite
> > abstract like . 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:
> 
> (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.



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


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] html templates?

2000-06-19 Thread R. David Murray

On Mon, 19 Jun 2000, Christian Scholz wrote:
> Imagine writing simple html templates with some custom tags which are quite
> abstract like . 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


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] html templates?

2000-06-19 Thread Kevin Dangoor

- Original Message -
From: "Christian Scholz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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 . 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:


(other than saving a few characters typing dtml-var)?

addresslist could be a property or another DTML method...

Kevin


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] html templates?

2000-06-19 Thread Christian Scholz

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 . 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 , e.g.
  to add a session id as additional parameter on every occurence of
  an -Tag.
  Also you will be able to automatically fill in -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:





and then use it in another tag:



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  is local to that template if you want.
Thus you can create templates for different lists and nevertheless use
a -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 [EMAIL PROTECTED]

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )