Mailing List Archive

[Zope-PTK] DISCUSS: Changing template construction
Jeffrey espoused an idea yesterday which I really liked. Instead
of:

<dtml-var std_header>
<h2>My Stuff</h2>
<dtml-var std_footer>

...he came up with (as standard_template):

<html>
....
<dtml-var insertedContents>
</html>

with all the site content pages as:

<dtml-template standard_template insertAs="insertedContents">
<h2>My Stuff</h2>
</dtml-template>

Thus, Jeffrey introduced a new tag that grabbed a renderer and passed
in the block as contents.

Difference number one: you don't have two things (header and footer)
to manage. Difference two: the combined header and footer are valid
HTML!!! Making the look of a site much easier to manage in tools like
Dreamweaver.

With Michel's old "multi-format document" and the "PTK Document",
Jeffrey's idea gets even easier. You don't wrap the content in a tag,
you just indicate in another part of the interface the location of the
rendering template. This makes the document just:

<h2>My Stuff</h2>

...which is the PTK way of doing contents.

I wonder if this should be the PTK way of doing things? OTOH, with PTK
Document, few people will know about the template that is rendering the
site.

Thoughts?

--Paul
Re: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
On Sat, Feb 19, 2000 at 10:37:19AM -0500, Paul Everitt wrote:

[snip template example]

> Thus, Jeffrey introduced a new tag that grabbed a renderer and passed
> in the block as contents.

Yup, that's great. It's even better than the old trick some people use
(<dtml-var standard_html_header>, <dtml-var content>, <dtml-var standard_html_footer> then manage "content").

> Difference number one: you don't have two things (header and footer)
> to manage. Difference two: the combined header and footer are valid
> HTML!!! Making the look of a site much easier to manage in tools like
> Dreamweaver.
>
> With Michel's old "multi-format document" and the "PTK Document",
> Jeffrey's idea gets even easier. You don't wrap the content in a tag,
> you just indicate in another part of the interface the location of the
> rendering template. This makes the document just:
>
> <h2>My Stuff</h2>
>
> ...which is the PTK way of doing contents.
>
> I wonder if this should be the PTK way of doing things? OTOH, with PTK
> Document, few people will know about the template that is rendering the
> site.
>
> Thoughts?

Go for it :)

-Petru
RE: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
-----Oorspronkelijk bericht-----
Van: Paul Everitt [SMTP:paul@digicool.com]
Verzonden: zaterdag 19 februari 2000 16:37
Aan: zope-ptk@zope.org; jeffrey@digicool.com
Onderwerp: [Zope-PTK] DISCUSS: Changing template construction


Jeffrey espoused an idea yesterday which I really liked. Instead
of:

<dtml-var std_header>
<h2>My Stuff</h2>
<dtml-var std_footer>

..he came up with (as standard_template):

<html>
....
<dtml-var insertedContents>
</html>

with all the site content pages as:

<dtml-template standard_template insertAs="insertedContents">
<h2>My Stuff</h2>
</dtml-template>

Thus, Jeffrey introduced a new tag that grabbed a renderer and passed
in the block as contents.

Difference number one: you don't have two things (header and footer)
to manage. Difference two: the combined header and footer are valid
HTML!!! Making the look of a site much easier to manage in tools like
Dreamweaver.

With Michel's old "multi-format document" and the "PTK Document",
Jeffrey's idea gets even easier. You don't wrap the content in a tag,
you just indicate in another part of the interface the location of the
rendering template. This makes the document just:

<h2>My Stuff</h2>

..which is the PTK way of doing contents.

I wonder if this should be the PTK way of doing things? OTOH, with PTK
Document, few people will know about the template that is rendering the
site.

Thoughts?

Hm. I like the idea. I posted some similar ideas (but much more general and (I'm afraid) complicated) to the zope-dev and zope-mozilla lists some weeks ago. Whereas they never got response, I think the problem this proposal _will not_ solve is the rendered vs non-rendered problem. This is always the big problem in Zope editing.

Rik
Re: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
----- Original Message -----
From: "Paul Everitt" <paul@digicool.com>
To: <zope-ptk@zope.org>; <jeffrey@digicool.com>
Sent: Saturday, February 19, 2000 10:37 AM
Subject: [Zope-PTK] DISCUSS: Changing template construction


[snip]
> with all the site content pages as:
>
> <dtml-template standard_template insertAs="insertedContents">
> <h2>My Stuff</h2>
> </dtml-template>
>
> Thus, Jeffrey introduced a new tag that grabbed a renderer and passed
> in the block as contents.
[snip]

I like this proposal. I think it does simplify things. (Boy, people who are
new to Zope after the PTK comes out will have nifty sites up and running
really quickly :)

One comment: if the template attribute of the <dtml-template> tag can take
an expression, this will also make for an easy way to do skins. (And you
don't even have to wait for the browsers to support CSS properly)

Kevin
Re: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
On 2/24/00 6:47 PM, Kevin Dangoor at kid@kendermedia.com wrote:

>
> I like this proposal. I think it does simplify things. (Boy, people who are
> new to Zope after the PTK comes out will have nifty sites up and running
> really quickly :)
>
> One comment: if the template attribute of the <dtml-template> tag can take
> an expression, this will also make for an easy way to do skins. (And you
> don't even have to wait for the browsers to support CSS properly)

Jeffrey and I talked about this a lot yesterday, and here's (pardon I've not
used it, just written on a whiteboard, but Jffrey will no doubt correct me,
when he stops playing with MacOS X DP3 :-)....

Here's the format we talked about:

<dtml-component template="component_template_name" insertAs="content">
...
...
...
</dtml-component>

Here's some reasoning...

* The reason he changed to <dtml-component> from <dtml-template> is that
you're not really describing a template, you're describing a component
rendered USING a template. On further thought this seems more self evident.

* No "name" attribute. There's also no "shortcuts". You must spell out all
attributes and their options. Theoretically, there could be other things
for a <dtml-component> instead of templates... i.e. widgets?

* There is a default "insertAs" attribute, 'template_contents'. You don't
have to specify.

* Should there be a default 'template'? We don't know :-)

Cris
--
| Christopher Petrilli Python Powered Digital Creations, Inc.
| petrilli@digicool.com http://www.digicool.com
Re: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
My proposal went a step beyond Jeffrey's and removed the need for a tag
to be inserted. Rather (as in Formatted Document on zope.org and
Michel's Multi-Format Document proposal), the template is specified in
the GUI. Having it optionally be in the body would be useful, though,
for things such as HTMLFile, editing in FTP, etc.

--Paul

Christopher Petrilli wrote:
>
> On 2/24/00 6:47 PM, Kevin Dangoor at kid@kendermedia.com wrote:
>
> >
> > I like this proposal. I think it does simplify things. (Boy, people who are
> > new to Zope after the PTK comes out will have nifty sites up and running
> > really quickly :)
> >
> > One comment: if the template attribute of the <dtml-template> tag can take
> > an expression, this will also make for an easy way to do skins. (And you
> > don't even have to wait for the browsers to support CSS properly)
>
> Jeffrey and I talked about this a lot yesterday, and here's (pardon I've not
> used it, just written on a whiteboard, but Jffrey will no doubt correct me,
> when he stops playing with MacOS X DP3 :-)....
>
> Here's the format we talked about:
>
> <dtml-component template="component_template_name" insertAs="content">
> ...
> ...
> ...
> </dtml-component>
>
> Here's some reasoning...
>
> * The reason he changed to <dtml-component> from <dtml-template> is that
> you're not really describing a template, you're describing a component
> rendered USING a template. On further thought this seems more self evident.
>
> * No "name" attribute. There's also no "shortcuts". You must spell out all
> attributes and their options. Theoretically, there could be other things
> for a <dtml-component> instead of templates... i.e. widgets?
>
> * There is a default "insertAs" attribute, 'template_contents'. You don't
> have to specify.
>
> * Should there be a default 'template'? We don't know :-)
>
> Cris
> --
> | Christopher Petrilli Python Powered Digital Creations, Inc.
> | petrilli@digicool.com http://www.digicool.com
Re: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
on 2/24/2000 11:33 PM, Christopher Petrilli at petrilli@digicool.com wrote::

> On 2/24/00 6:47 PM, Kevin Dangoor at kid@kendermedia.com wrote:
>
>>
>> I like this proposal. I think it does simplify things. (Boy, people who are
>> new to Zope after the PTK comes out will have nifty sites up and running
>> really quickly :)
>>
>> One comment: if the template attribute of the <dtml-template> tag can take
>> an expression, this will also make for an easy way to do skins. (And you
>> don't even have to wait for the browsers to support CSS properly)

If someone else wants to deal with expression support and all the issues
related to it, they can. The tag I wrote does::

Snarfs up its inner contents (block contents)

Pushes them onto the namespace (the multidict) bound to the "insertas"
attribute (default is "component-contents"),

Returns the DTML Method from the "insertas" attribute without even
rendering it (the DTML engine seems to take care of this).

And does a "finally: md._pop(1)" to pop the block contents off the
namespace stack.

I've done "skins" by writing Python methods in the class I'm writing this in
(not to be confused with web base PythonMethods) that change the template
value in the call, ala

return self.registrationForm(self, REQUEST,
my_cool_template=self.manageTemplate)

Without a more thought out model-view-controller/presenter paradigm in
place, I've been quite happy with doing this. The current project I'm
experimenting with this in is an entirely disk based Python product where I
have some more liberty to apply some design and construction techniques
borrowed from some Openstep-ish conventions.

> Jeffrey and I talked about this a lot yesterday, and here's (pardon I've not
> used it, just written on a whiteboard, but Jffrey will no doubt correct me,
> when he stops playing with MacOS X DP3 :-)....
>
> Here's the format we talked about:
>
> <dtml-component template="component_template_name" insertAs="content">
> ...
> ...
> ...
> </dtml-component>
>
> Here's some reasoning...
>
> * The reason he changed to <dtml-component> from <dtml-template> is that
> you're not really describing a template, you're describing a component
> rendered USING a template. On further thought this seems more self evident.

Right. And this doesn't have to be full page -- you could have other little
components on the page.

> * No "name" attribute. There's also no "shortcuts". You must spell out all
> attributes and their options. Theoretically, there could be other things
> for a <dtml-component> instead of templates... i.e. widgets?

Yep. no shortcuts == easier (theoretically) to get Golive, Alpha, and
Dreamweaver to handle things easier. And this tag was really written so
that I could work with my preferred editors a bit easier. I'm also thinking
of adding an optional "id" attribute whose only purpose might be for XML-ish
parsing.

> * There is a default "insertAs" attribute, 'template_contents'. You don't
> have to specify.

component-contents.

> * Should there be a default 'template'? We don't know :-)

I don't know if there should, I just prefer spelling it out. Shortcuts now
== headaches later. And I like the possibility of just marking a section of
DTML/HTML and identifying it as a component and being able to extract it
somewhere else (such as a *gulp* "wizard").

--
Jeffrey P Shell, jeffrey@Digicool.com
http://www.zope.org/
Re: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
on 2/25/2000 7:36 AM, Paul Everitt at paul@digicool.com wrote::

> My proposal went a step beyond Jeffrey's and removed the need for a tag
> to be inserted. Rather (as in Formatted Document on zope.org and
> Michel's Multi-Format Document proposal), the template is specified in
> the GUI. Having it optionally be in the body would be useful, though,
> for things such as HTMLFile, editing in FTP, etc.

I love the formatted document, but I wouldn't build an application's user
interface out of them, I think they're more appropriate for end-user use.
They're definitely higher up the foggy tree of abstraction than what I'm
using my tag for.

--
Jeffrey P Shell, jeffrey@Digicool.com
http://www.zope.org/
Re: [Zope-PTK] DISCUSS: Changing template construction [ In reply to ]
Paul Everitt (on the Zope-PTK mailing list) wrote:
>
> Jeffrey espoused an idea yesterday which I really liked. Instead
> of:
... [snipped]

> I wonder if this should be the PTK way of doing things? OTOH, with PTK
> Document, few people will know about the template that is rendering the
> site.
>
> Thoughts?
(full text of above msg:
http://lists.zope.org/pipermail/zope-ptk/2000-February/000347.html)


I hope you don't mind my (a PTK non-user) instrusion into the thread but I feel
this template thing has a greater scope than just the PTK.

I have just posted my ideas about it to the Zope-Mozilla list.
(http://lists.zope.org/pipermail/zope-mozilla/2000-February/000125.html)

I look at templates as 'reusable patterns' of DTML. The example given by Paul
is really the following pattern:

<dtml-var standard_html_header>
<dtml-var text>
<dtml-var standard_html_footer>

This is simple and fixed. There could be complex patterns also. Consider the
pattern used for populating a table with some data:

<table>

(for each columnName parameter)
<tr><td> <dtml-var columnName>
(end for)

</table>

If this pattern could be defined, it could be reused. And then all that would
be needed to produce a populated table would be a set of parameters
(column names and order, etc) and the template name.

There has been some activity about this idea on this (PTK) list. What is the
status?

Thanks,
Shalabh