[Zope] chapter 5 Zope book - problems with the examples

Max Møller Rasmussen maxm@normik.dk
Thu, 16 Nov 2000 15:12:59 +0100


You have an aquisition/namespace problem.

If <dtml-var navigation> is used in a document like an index_html
dtml-document, It tries to find the objecValues in that document. But a
document is not a folder.  So the list will be empty.

So is your index_html a document or method? Try changing it to a method, as
a method doesn't have it's own namespace and will look in the nearest
aquired namespace. Hopefully a folder.

Or use a more direct approach bu telling what folder you want to see
objectValues from.

<dtml-in expr="someFolder.objectValues('Folder')">
  <li><a href="&dtml-absolute_url;"><dtml-var title_or_id></a><br></li>
</dtml-in>

Regards
Max M

-----Original Message-----
From: Lee Reilly CS1997 [mailto:lreilly@cs.strath.ac.uk]
Sent: Thursday, November 16, 2000 2:41 PM
To: zope@zope.org
Subject: [Zope] chapter 5 Zope book - problems with the examples


Hi,

I'm going through the examples in Chapter 5 of the Zope book and am
having some problems. For those of you familiar with it, it is the 'Zope
Zoo' example.

Can anyone help me out?

1 - I create a DTML method called navigation as follows:

<ul>
<dtml-in expr="objectValues('Folder')">
  <li><a href="&dtml-absolute_url;"><dtml-var title_or_id></a><br></li>
</dtml-in>
</ul>

2 - On viewing this method it works fine - a hyperlink to all
sub-folders appears in the browser.

3 - I add '<dtml-var navigation>' into my standard_html_header so it
reads:

<html>
<head>
<title>ZAPHOD - zopetastic!</title>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
</head>
<body bgcolor="#FFFFFF" LINK="#000099" VLINK="#555555">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
If your name is Lee then click <a href="manage">here</a> to
login.</font> 
<br>
<dtml-var navigation>

4 - On viewing index.html (containing header & footer) everything except
the navigation method appears. Viewing the source of index.html reveals
that the <ul> tags are created... just no <li> elements.

5 - The HTML is fine... all tags closed & in te right place.

Can anyone see a problem?

Thanks in advance for any replies. My appologies also for such a long
post.

- Best regards,
Lee Reilly

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