[ZOPE] newbie question: getting title_or_id from calling document

Simon Brogden sbrogden@ehive.co.uk
Tue, 16 Oct 2001 12:53:15 +0100


I don't think I've expressed the problem clearly enough. It's not the
folder title we need, it's the title/ID of the document/method that
includes the header(via "dtml-var standard_header") .

The site has pages with a lot of common content that can be split into
the standard_header or standard_footer objects. The header has an HTML
block:
....
<head>
  <title><dtml-var title_or_id></title>
</head>
....

When the header is used by a page, I want the title to be that of the
page that includes it, not the name of the header file. So, if
index_html, with a title of "Homepage" has:
<dtml-var standard_header>

I want the resultant HTML to look like:
....
<head>
  <title>Homepage</title>
</head>
....

Not "header" or the title of the standard_header file.=20

I'm guessing that the same is going to apply to the footer, as it needs
to display the modification time.

I want to make the maintenance of the site easier by lumping together
the common parts. If I can't get the above to work, I'm assuming that
the only resort is to be long-winded (like my email) and forget about
using headers & footers and hardcode these bits into every page. There's
a lot of JavaScript too, which needs substitution for each page it's
used on. So it's not just the HTML title block.

Am I missing a technique/being thick?

Tanks for your time,
Simon.

-----Original Message-----
From: Trevor Toenjes [mailto:zope@toenjes.com]
Sent: 15 October 2001 19:25
To: Simon Brogden; zope@zope.org
Subject: RE: [ZOPE] newbie question: getting title_or_id from calling
document


>I then created another header
> (public_header) and test (testing) DTML methods, and get the same
> results when I try to display the title/ID of the calling document in
> the public_header DTML method.

If you want the title of the folder, then your calling-Document needs to
be
a method.  If there is no reason that your DTML-Doc has to be a doc,
this is
your solution.
DTML-docs are folderish and have their own properties that will be
inherited
by a method in the namepsace, overriding the folder properties.
This is why I have been told dont use DTML-Docs.

I am sure there is some DTML-magic workaround for your public_header
that
only calls the title of the objecttype('Folder').  But sometimes Zope
work-arounds are a replacement for mis-used object types and
architecture.

-Trevor

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Simon
> Brogden
> Sent: Monday, October 15, 2001 1:47 PM
> To: zope@zope.org
> Subject: RE: [ZOPE] newbie question: getting title_or_id from calling
> document
>
>
> Thanks for the swift reply Trevor, very much appreciated.
>
> I think I understand what you mean, but I'm unsure as to the solution.
>
> I've recreated the header and the index_html as DTML methods, both in
> the same folder, and know get the folder name as the title, as
expected
> based on what you said in your email. I then created another header
> (public_header) and test (testing) DTML methods, and get the same
> results when I try to display the title/ID of the calling document in
> the public_header DTML method.
>
> I'm at a loss on how to proceed to solve my problem.
>
> Can anyone help?
>
> Thanks for your time,
> Simon.
>
> -----Original Message-----
> From: Trevor Toenjes [mailto:zope@toenjes.com]
> Sent: 15 October 2001 18:28
> To: Simon Brogden; zope@zope.org
> Subject: RE: [ZOPE] newbie question: getting title_or_id from calling
> document
>
>
> >From one Newbie to another...
>
> DTML-methods inherit the properties of the calling container.  In many
> cases, this is the folder that is being rendered.  So the index_html
> that is
> called from the folder, takes on the properties, title, id, etc, from
> that
> folder.  This assumes that index_html is a method and not a Doc.
> It took me a couple weeks using Zope to realize that the default
folder
> set-up that includes index_html as a document should seldom be used...
> <read...never>  (Actually I suggest that this should be removed from
the
> ZMI, because it trips up most newbies.  Or at least give the option to
> create index_html as a method.)
> Most of the Zopistas have told me that DTML-Documents are bad.
> In general you will mostly want to use Methods for everything that is
an
> object or part of a template.
> DTML-Documents are good for just content. <read...text.>
>
> And consider the emminent message from anyone saying "USE ZPT instead
of
> DTML".  ;)
>
> -Trevor
>
>
>
> > -----Original Message-----
> > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Simon
> > Brogden
> > Sent: Monday, October 15, 2001 1:05 PM
> > To: zope@zope.org
> > Subject: [ZOPE] newbie question: getting title_or_id from calling
> > document
> >
> >
> > Hello!
> >
> > I'm trying to create a standard_header that when included in a
> document
> > uses the calling documents namespace. So, if the standard_header
was:
> > <html>
> > <head>
> > <title><dtml-var title_or_id></title
> > </head>
> > ...
> > ...
> >
> > and the index_html document had as it's first line:
> > <dtml-var standard_header>
> >
> > How can I make the standard header DTML document write the title/ID
of
> > index_html or any of the documetns that call/include it?.
> >
> > Apologies in advance if I'm being thick.
> >
> > Cheers,
> > Simon.
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > 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  -  Zope@zope.org
> 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 )
>