RE: [Zope] site structure (fwd)

2000-12-14 Thread sean . upton

Getting fairly familiarized with namespaces and acquisition is going to be
useful here.

You actually will need to do 2 templates (one for the footer, and one for
the header) in the case of writing a "wrapper."   That said, objects in Zope
(like a document, in this case) behave based upon their context or
environment.  A DTML document, when it is told to render something with
 looks for foo in it's current namespace (i.e. the
folder it is in), and if it doesn't find it, it then works its way upward
(by looking in the namespace of the folder that is the parent of the folder
it just looked in before).  When it finds foo, it renders that method (or if
foo is an attribute, it renders its value).  

Let us suppose that your document is called bar, and looks like this:

 


bar is in a folder hierarchy that looks like this (using URL syntax)

http://mysite.com/folder1/subfolder/bar

bar would first look for foo as an attribute of it's own namespace (i.e. it
would look to see if you defined a custom property called foo in the
properties of the document).  If it found it, it would render it, but let's
suppose that it does not find it, so it has to look in another namespace.

So, it moves up to the next namespace (subfolder) looking for foo, as either
a method of that folder or a data member (attribute).  If it finds it, it
renders it.  If not, it moves up to folder1 as the next namespace, and
perhaps that is where it finds foo; in that case it renders foo.  Seems
rather simple, and in some cases it is, but what if foo is a dtml method and
looks like the following?

Title:

Where does foo look for title? Not in folder1, where foo resides, but in in
bar's namespace, and indeed, since dtml documents have a title attribute,
that will be rendered.  If, instead of title, we had an attribute named
something like "what" but there was no attribute named "what" in bar, it
would look through the namespace stack (starting with the namespaces of bar,
then subfolder then folder1, then the root folder, etc), until it found what
it was looking for.

This, I hope, explains acquisition well.  If you were to apply this to
templating strategies, you would realize, that (as long as you kept
standard_html_header and standard_html_footer in sync) that you could do
some powerful things with your site navigation.  Consider the following
example:

Suppose you have a sports news site, and you publish stories about baseball,
football, and basketball.  In the upper right hand-corner of your document
(i.e. in the header portion) you have an 32x32 icon image that is a picture
of a football, basketball, and baseball, respectively.  Otherwise, you
wanted to use the same template for all of the documents.  

Suppose that you have a folder structure like this:
-/
   -basketball
   -baseball
   -football

In this case, you could have a standard_html_header in the root folder /
that creates the top portion of your document, so you only have to use one
template, and that the template might have code that looks like this:





In this case, you could have an image in each folder (basketball, football,
baseball) containing an appropriate image with the id of sports-icon.gif.
This is useful, because now, one template is rendering sports news stories
different folders differently, depending upon the context of the folder they
are contained in.  

In this simple example, you don't even need to create a different
standard_html_header for every folder to create different results, but can
rely upon Zope's built-in acquisition smarts to work for you.  Applying this
in practice, takes some playing around with, but once you get a clear idea
of applying this, you can create some very intelligent standard_html_headers
that do a lot of work for you.

Hope this helps,

Sean

-Original Message-
From: Nuno Goncalves [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 14, 2000 10:19 AM
To: Oleg Broytmann
Cc: Max M; Zope@Zope. Org
Subject: RE: [Zope] site structure (fwd)


> > But how could you build a page with the template developed ??
> > something like:
> > 
> > and how can you generelize the objects to beeing used by the template ?
> 
>No, no, no! :)
>You misunderstand how the Zope works. You think that basic building
> block is a piece of HTML (probably you think to put it into DTML
> Documents). No. In Zope basic building block is "instance of some python
> class". A DTML Document is an instance of DTMLDocument class, e.g.
>If you develop your own set of classes, you'll just build Zope sites
> creating instances of these classes - you put HTML fragmenst just into
> these instances. Zope will call your objects, you don't need to use DTML
to
> call them.

humm !!! I see now !!
So i can have a general structure for all my site and when create a
page, specifying the template to use and consequently

RE: [Zope] site structure (fwd)

2000-12-14 Thread Oleg Broytmann

On Thu, 14 Dec 2000, Nuno Goncalves wrote:
> humm !!! I see now !!
> So i can have a general structure for all my site and when create a
> page, specifying the template to use and consequently adding the objects
> that i want ??

   No, you should separate design (template) and content. Actually, it is
possible even without creating a python product - you put content (HTML
fragments) into small DTML Documents, and define design (template) using
DTML Methods - standard_html_header/footer and other methods, your custom
methods.

   Think, for example, you want to create a site with the following design:

-
 | ||
left | CONTENT1| right  |
column   | | column |
 | special ||
 | fature  ||
 | ||
 | CONTENT2||
 | ||
-

   Easy! (Thanks, Zope! :)

   You define "left column" in standard_html_header, "right column" in
standard_html_footer, in every folder put two pieces of content and feature
into 3 DTML Documents, and call these Documents again from
standard_html_header (or DTML Methods that will be called from
standard_html_header).

   In outline, your standard_html_header will looks like the following:


I'll skip most HTML-related things like tr td etc
   

   

   

   

Oleg.

 Oleg Broytmann http://www.zope.org/Members/phd/ [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
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] site structure (fwd)

2000-12-14 Thread sean . upton

You may also want to take a look at HiperDOM as a templating mechanism as
well.  I haven't used it, but in looking at the Wiki and the examples, it
looks like it would do what you are looking for, and from all accounts I
have read, this will be the "official" Zope replacement for DTML for
presentation logic in the future (relegating DTML for logic use, along with
Perl and Python methods), and has a lot of cool features that allow you to
create a template with mockup data that actually renders your presentation,
replacing the mockup.

http://www.zope.org/Members/lalo/HiperDom

I'm working on a content-management project in which I am just starting to
do real user interface work, and I am likely going to try switching over
most of the presentation from DTML to HiperDOM.  Anyway, creating valid
XHTML documents for templates is an exciting idea, especially in the sense
that this decreases the learning curve for a designer needing to work on
presentation, but not logic - that is a definite need in my organization.

Cheers,
Sean

-Original Message-
From: Nuno Goncalves [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 14, 2000 9:51 AM
To: Max M
Cc: [EMAIL PROTECTED]; Zope@Zope. Org
Subject: RE: [Zope] site structure (fwd)


i see !!!
i have just found a package ZopeFish that has ZFSuite.
ZFSuite has an object (ZF document template) that 
defines a layout and structure for the entire site.

More info at
http://www.zope.org/WikiCentral/ZFWiki

still
i installed it (it is a bunch of libs) but i haven't tested it !

if i get it work i will tell you 

thanks


On Thu, 14 Dec 2000, Max M wrote:

> From: Oleg Broytmann
> 
> >> But that way if i want to change the structure, i have to change on
every
> >> page.
> 
> >   No, you only need to change 2 places: standard_html_header and
> >standard_html_footer :) All Documents that use these header/footer will
be
> >rendered using new structure.
> 
> I think you misunderstand him. He is actually right.
> 
> Some things are pretty hard to do in zope, because of the header/footer
> principle.
> 
> Making a global look to a site can be pretty difficult if it doesn't fit
> nicely into a header/footer structure, with a main area being the pages'
> unique content.
> 
> If I where to do it in regular Python I would use special classes for
> special layouts. That is hard to do in Zope.
> 
> Regards maxm
> 
> Max M. W. Rasmussen,Denmark.   New Media Director
> private: [EMAIL PROTECTED] work: [EMAIL PROTECTED]
> -
> Specialization is for insects.  -  Robert A. Heinlein
> 
> 
> ___
> 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 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 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] site structure (fwd)

2000-12-14 Thread Nuno Goncalves

> > But how could you build a page with the template developed ??
> > something like:
> > 
> > and how can you generelize the objects to beeing used by the template ?
> 
>No, no, no! :)
>You misunderstand how the Zope works. You think that basic building
> block is a piece of HTML (probably you think to put it into DTML
> Documents). No. In Zope basic building block is "instance of some python
> class". A DTML Document is an instance of DTMLDocument class, e.g.
>If you develop your own set of classes, you'll just build Zope sites
> creating instances of these classes - you put HTML fragmenst just into
> these instances. Zope will call your objects, you don't need to use DTML to
> call them.

humm !!! I see now !!
So i can have a general structure for all my site and when create a
page, specifying the template to use and consequently adding the objects
that i want ??

Nuno

> 
> Oleg.
> 
>  Oleg Broytmann http://www.zope.org/Members/phd/ [EMAIL PROTECTED]
>Programmers don't die, they just GOSUB without RETURN.
> 
> 


___
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] site structure (fwd)

2000-12-14 Thread Oleg Broytmann

On Thu, 14 Dec 2000, Nuno Goncalves wrote:
> >Why hard? Not hard at all - develop your own set of classes, make it
> > into a Product, and use instance of these classes instead of DTML
> > Documents. Actually, there is nothing special in DTML Documents - they are
> > instances of DTMLDocument class, nothing more. Creating your own type of
> > document is not harder, IMHO.
>
> I was thinking about that to !
> But how could you build a page with the template developed ??
> something like:
> 
> and how can you generelize the objects to beeing used by the template ?

   No, no, no! :)
   You misunderstand how the Zope works. You think that basic building
block is a piece of HTML (probably you think to put it into DTML
Documents). No. In Zope basic building block is "instance of some python
class". A DTML Document is an instance of DTMLDocument class, e.g.
   If you develop your own set of classes, you'll just build Zope sites
creating instances of these classes - you put HTML fragmenst just into
these instances. Zope will call your objects, you don't need to use DTML to
call them.

Oleg.

 Oleg Broytmann http://www.zope.org/Members/phd/ [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
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] site structure (fwd)

2000-12-14 Thread Nuno Goncalves

On Thu, 14 Dec 2000, Oleg Broytmann wrote:

> On Thu, 14 Dec 2000, Max M wrote:
> > If I where to do it in regular Python I would use special classes for
> > special layouts. That is hard to do in Zope.
> 
>Why hard? Not hard at all - develop your own set of classes, make it
> into a Product, and use instance of these classes instead of DTML
> Documents. Actually, there is nothing special in DTML Documents - they are
> instances of DTMLDocument class, nothing more. Creating your own type of
> document is not harder, IMHO.

I was thinking about that to !
But how could you build a page with the template developed ??
something like:

and how can you generelize the objects to beeing used by the template ?


> 
> Oleg.
> 
>  Oleg Broytmann http://www.zope.org/Members/phd/ [EMAIL PROTECTED]
>Programmers don't die, they just GOSUB without RETURN.
> 
> 
> ___
> 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 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] site structure (fwd)

2000-12-14 Thread Nuno Goncalves

i see !!!
i have just found a package ZopeFish that has ZFSuite.
ZFSuite has an object (ZF document template) that 
defines a layout and structure for the entire site.

More info at
http://www.zope.org/WikiCentral/ZFWiki

still
i installed it (it is a bunch of libs) but i haven't tested it !

if i get it work i will tell you 

thanks


On Thu, 14 Dec 2000, Max M wrote:

> From: Oleg Broytmann
> 
> >> But that way if i want to change the structure, i have to change on every
> >> page.
> 
> >   No, you only need to change 2 places: standard_html_header and
> >standard_html_footer :) All Documents that use these header/footer will be
> >rendered using new structure.
> 
> I think you misunderstand him. He is actually right.
> 
> Some things are pretty hard to do in zope, because of the header/footer
> principle.
> 
> Making a global look to a site can be pretty difficult if it doesn't fit
> nicely into a header/footer structure, with a main area being the pages'
> unique content.
> 
> If I where to do it in regular Python I would use special classes for
> special layouts. That is hard to do in Zope.
> 
> Regards maxm
> 
> Max M. W. Rasmussen,Denmark.   New Media Director
> private: [EMAIL PROTECTED] work: [EMAIL PROTECTED]
> -
> Specialization is for insects.  -  Robert A. Heinlein
> 
> 
> ___
> 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 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] site structure (fwd)

2000-12-14 Thread Stephane Bortzmeyer

On Thu, Dec 14, 2000 at 06:25:19PM +0100, Max M wrote:

> Some things are pretty hard to do in zope, because of the header/footer
> principle.
> 
> Making a global look to a site can be pretty difficult if it doesn't fit
> nicely into a header/footer structure, with a main area being the pages'
> unique content.

Although I agree that Zope misses real templates (like in M4 or, to
take a more Web-centric example, in WML
, there are several workarounds:

1) if you need "standard" elements between header and footer, a bit of
  discipline from the page authors (which can be helped by tools like
  HTML-kit, where you can define a template for the new and empty
  page):

  
  ... Content here
  
  .. More content here
  

2) DTML methods allow you to replace a lot of what would be
   document-specific elements (such as context-dependant navigation
   bars), helping to stay in the header/footer paradigm. On the other
   hand, they are very complicated to use properly.


___
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] site structure (fwd)

2000-12-14 Thread Oleg Broytmann

On Thu, 14 Dec 2000, Max M wrote:
> If I where to do it in regular Python I would use special classes for
> special layouts. That is hard to do in Zope.

   Why hard? Not hard at all - develop your own set of classes, make it
into a Product, and use instance of these classes instead of DTML
Documents. Actually, there is nothing special in DTML Documents - they are
instances of DTMLDocument class, nothing more. Creating your own type of
document is not harder, IMHO.

Oleg.

 Oleg Broytmann http://www.zope.org/Members/phd/ [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
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] site structure (fwd)

2000-12-14 Thread Max M

From: Oleg Broytmann

>> But that way if i want to change the structure, i have to change on every
>> page.

>   No, you only need to change 2 places: standard_html_header and
>standard_html_footer :) All Documents that use these header/footer will be
>rendered using new structure.

I think you misunderstand him. He is actually right.

Some things are pretty hard to do in zope, because of the header/footer
principle.

Making a global look to a site can be pretty difficult if it doesn't fit
nicely into a header/footer structure, with a main area being the pages'
unique content.

If I where to do it in regular Python I would use special classes for
special layouts. That is hard to do in Zope.

Regards maxm

Max M. W. Rasmussen,Denmark.   New Media Director
private: [EMAIL PROTECTED] work: [EMAIL PROTECTED]
-
Specialization is for insects.  -  Robert A. Heinlein


___
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] site structure (fwd)

2000-12-14 Thread Oleg Broytmann

> >Using standard_html_header and standard_html_footer in every Document on
> > your site...
> But that way if i want to change the structure, i have to change on every
> page.

   No, you only need to change 2 places: standard_html_header and
standard_html_footer :) All Documents that use these header/footer will be
rendered using new structure.

Oleg.

 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
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 )