[Zope] Special behavior or bug?

Chris Gray cpgray@library.uwaterloo.ca
Fri, 24 Nov 2000 22:49:47 -0500 (EST)


Oops! I spoke way too soon.

Try <dtml-var document_title> but you can't use it in a header or it will
give you the title of the header.

You can use the following code in a header:

<dtml-in objectValues>
<dtml-if expr="_['id']==_.string.split(URL, '/')[-1]">
<hr><dtml-var expr="this().title"><hr>
</dtml-if>
</dtml-in>

although it is a bit indirect and fragile: it will only work if you want
the title of DTML Method 'foo' and it is in folder 'bar' and the URL you
use to get it ends '/bar/foo', but it works in a header that is somewhere
else.  You can modify objectValues to expr="bar.objectValues()" but then
it won't work in a header called by methods not in 'bar'.  Another
possible modification is expr="PARENTS[1].objectValues()".

Cheers,
Chris


On Fri, 24 Nov 2000, Chris Gray wrote:

> Sorry, but my understanding (which certainly may be wrong, since I don't
> fully grasp the ins and outs of this yet) is that the namespace starts
> with the client object to which the method is bound.  The attributes (like
> title) of the method never get into the namespace.  This is part of the
> design of DTML Methods; they can be bound to a variety of objects while
> still giving full access to the client's namespace.  This is why the trick
> of calling a DTML Document's title from an embedded DTML header Method
> works.  The effect you want to achieve depends on this distinction between
> DTML Methods and Documents.
> 
> Another way to say this is that the distinction between DTML Documents and
> Methods allows a separation of content and logic.  Put your content
> (including Titles that will be significant to your visitors) in Documents
> and your logic in Methods.
> 
> Cheers,
> Chris
> 
> On Fri, 24 Nov 2000, Dany Rioux wrote:
> 
> > Chris, I can't change all the other DTML Methods to DTML Docs... I
> > would have to have only 1 DTML Method which is unthinkable.
> > 
> > Now, I'm sure there's a way to force what I want to do. Either with a
> > REQUEST.set('[calling_document.Title]') or something real :)
> > 
> > Is there such a function? (I'm sorry, I'm still confused on how to
> > call things in Zope.)
> > 
> > As for the Ferengi rules of acquisition, at least, I'm pretty sure I'd
> > get some profits :) haha But, unfortunately, my ears are not as
> > erogenous as the Ferengies.  :)
> > 
> > Dany
> > 
> > > Make sure that the standard_html_header is a DTML Method
> > > and not a DTML
> > > Document.  Make sure that the calling document is DTML
> > > Document and not a
> > > DTML Method and it should work.  That way the header
> > > acquires the title of
> > > the calling document.  If the calling document is a DTML Method, it
> > > acquires it's title from somewhere else according to the
> > > Zope rules of
> > > acquisition (as opposed to the Ferengi rules of acquisition ;).
> > >
> > > Cheers,
> > > Chris
> > >
> > >
> > > On Fri, 24 Nov 2000, Dany Rioux wrote:
> > >
> > > > Hi, yeah, I know, it's me again :)
> > > >
> > > > I've got this snippet in the standard_html_header hoping it would
> > > > display the title of the calling document but instead displays the
> > > > index_html's title... Is this the normal behavior? I know
> > > yesterday it
> > > > was working... I tried refreshing the page but it's a no
> > > go. It simply
> > > > refuses to put the correct title. It doesn't even put the header's
> > > > file title... (something I guessed it would do the first
> > > time I tried
> > > > it)
> > > >
> > > > Any opinion on that?
> > > >
> > > > ---<PASTE>---
> > > >   <tr>
> > > >     <td align="right"><H2><dtml-var title></H2></td>
> > > >   </tr>
> > > > ---</PASTE>---
> > 
> > 
> > _______________________________________________
> > 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 )
>