Zope question

Martijn Faassen m.faassen at vet.uu.nl
Mon Mar 13 11:46:25 EST 2000


Gabriel Soubies <soubies at ese-metz.fr> wrote:
> I know this is not exactly a python question, but there is no Zope NG and
> many python users know Zope, so I figured you could help me.

Do subscribe to the Zope mailing list! Your questions on Zope are really
more appropriate there. Note that the mailing list is very busy though,
so be sure to have somekind of mail filter in place.

Subscribing is easy, go to:

http://www.zope.org/Resources/MailingLists

> I'm a beginner and I've created a folder with the standart elements of my
> web pages (header, footer, etc...), those that come up again and again in
> each page I create.

Right -- you'd put these in the root folder.

> I've created another folder with the texts of the pages I wish to create.

I don't think that's the best technique; better is to place the texts
in the folders themselves.

> And then I've created a last folder to contain the final pages.

I'm not quite sure what you mean there.

> All documents in this folder have the same format, that is:

> <table>
> <TR>
> <TD>
> <dtml-var GeneralMenu>
> </TD>
> <TD>
> <dtml-var PageText>
> </TD>
> </TR>
> <dtml-var Footer>

You could have folders instead of documents here, and put this template in
index_html of the root. (with standard_html_header and standard_html_footer
imported in). (Also I'd close your <table> with </table> if I were you!)

> The general structure of the table is right, I've tried it.
> GeneralMenu is a DTML document in the standart elements folder.

You could put this in the root folder instead and it'll work, or instead
you could do this:

<dtml-with your_standard_elements_folder>
<dtml-var GeneralMenu>
</dtml-with>

> PageText is the text of the page, it's a DTML document in the text folder
> (the second on I explained).

I'd just create a PageText DTML document (or method) in the folder where
you need it.

> Footer is again in the standart elements folder.

> The only thing is it doesn't work.

> The problem is a path problem. I don't know how to indicate an absolute
> path, because when I place all thes documents in the root folder, it works,
> but when I place them in different folder, it doesn't any more. It says the
> IDs don't exist.
> My question is :how do paths work?

I think you need to read up some howtos on acquisition at first. Then
you'll see why it may be a bad idea to refer to absolute paths; you 
lose some of the power of acquisition. Try the following setup instead:

in root folder:

standard_html_header
standard_html_footer
index_html (with layout as above)  # uses PageText and GeneralMenu with dtml-var
GeneralMenu

in any other folder:
PageText (with the text inside)

If you then view the folder you'll see the page in the right layout. You
can override any parts in your folder by putting in your own index_html,
header, footer or GeneralMenu, but avoid that if you can, as it may
involve duplication of code and general problems with maintainability.

I hope that helps!

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list