[Zope] DTML Method not working

Manuel Amador (Rudd-O) amador@alomega.com
Tue, 17 Oct 2000 00:12:16 -0500


--------------0D43265D657296791815E7E1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

<dtml-with "PARENT[0]">
<dtml-tree>

Phil Harris wrote:

> Is the code you used in a DTML Method or a DTML Document?
>
> Is it in a DTML Method being called from a DTML Document?
>
> If the answer to either of these is 'yes' then it's doing as you ask!
>
> The thing that gets most new zope users is that a DTML Document is itself a
> container.  This means that anytime you use code similar to yours or when
> using a <dtml-tree ...> it will probably return a blank, as the DTML
> Dopcument has no children(?!?).
>
> Solutions:
>
> 1.    Try moving the code into a DTML Method.
> 2.    Use a dtml-with around it.
>
> The second one works most places but if in the root then it's slightly more
> difficult as the top object is hard to reference (please someone tell me I'm
> wrong here).
>
> You could try something like:
>
> <dtml-with expr="resolve_url(BASE0+'/')">
> <ul>
> <dtml-in expr="objectValues('Folder')">
>  <li><a href="&dtml-absolute_url;"><dtml-var title_or_id></a><br></li>
> </dtml-in>
> </ul>
> </dtml-with>
>
> The resolve_url(BASE0+'/') should give you a reference to the top Zope
> object (root).
>
> hth
>
> Phil
> phil.harris@zweb.co.uk
>
> ----- Original Message -----
> From: "Ronald L. Chichester" <complaw@hal-pc.org>
> To: <zope@zope.org>
> Sent: Sunday, October 08, 2000 8:58 PM
> Subject: [Zope] DTML Method not working
>
> > I took some code that was in the (work-in-progress) O'Riley book on
> > Zope.  In that example, then had a DTML Method used for identifying
> > folders and hyperlinking to them.  The code is 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>
> >
> > The problem is, it doesn't work.  I know the method is being invoked
> > because there is some other text that is indeed being inserted.
> > Moreover, there are sub-folders in the folder that calls the method.
> >
> > Does anyone know what the problem is?  Is it a permission issue.  The
> > standard_html_header and _footer, show up just fine, along with logos
> > and such.  The only part that isn't showing up is the stuff that was
> > supposed to be generated by the <dtml-in> block.
> >
> > Any hints?
> >
> > Thanks in advance.
> >
> > Ron
> >  ./.
> >
> >
> > _______________________________________________
> > 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 )

--
Manuel Amador (Rudd-O)



--------------0D43265D657296791815E7E1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
&lt;dtml-with "PARENT[0]">
<br>&lt;dtml-tree>
<p>Phil Harris wrote:
<blockquote TYPE=CITE>Is the code you used in a DTML Method or a DTML Document?
<p>Is it in a DTML Method being called from a DTML Document?
<p>If the answer to either of these is 'yes' then it's doing as you ask!
<p>The thing that gets most new zope users is that a DTML Document is itself
a
<br>container.&nbsp; This means that anytime you use code similar to yours
or when
<br>using a &lt;dtml-tree ...> it will probably return a blank, as the
DTML
<br>Dopcument has no children(?!?).
<p>Solutions:
<p>1.&nbsp;&nbsp;&nbsp; Try moving the code into a DTML Method.
<br>2.&nbsp;&nbsp;&nbsp; Use a dtml-with around it.
<p>The second one works most places but if in the root then it's slightly
more
<br>difficult as the top object is hard to reference (please someone tell
me I'm
<br>wrong here).
<p>You could try something like:
<p>&lt;dtml-with expr="resolve_url(BASE0+'/')">
<br>&lt;ul>
<br>&lt;dtml-in expr="objectValues('Folder')">
<br>&nbsp;&lt;li>&lt;a href="&amp;dtml-absolute_url;">&lt;dtml-var title_or_id>&lt;/a>&lt;br>&lt;/li>
<br>&lt;/dtml-in>
<br>&lt;/ul>
<br>&lt;/dtml-with>
<p>The resolve_url(BASE0+'/') should give you a reference to the top Zope
<br>object (root).
<p>hth
<p>Phil
<br>phil.harris@zweb.co.uk
<p>----- Original Message -----
<br>From: "Ronald L. Chichester" &lt;complaw@hal-pc.org>
<br>To: &lt;zope@zope.org>
<br>Sent: Sunday, October 08, 2000 8:58 PM
<br>Subject: [Zope] DTML Method not working
<p>> I took some code that was in the (work-in-progress) O'Riley book on
<br>> Zope.&nbsp; In that example, then had a DTML Method used for identifying
<br>> folders and hyperlinking to them.&nbsp; The code is as follows:
<br>>
<br>> &lt;ul>
<br>> &lt;dtml-in expr="objectValues('Folder')">
<br>>&nbsp; &lt;li>&lt;a href="&amp;dtml-absolute_url;">&lt;dtml-var title_or_id>&lt;/a>&lt;br>&lt;/li>
<br>> &lt;/dtml-in>
<br>> &lt;/ul>
<br>>
<br>> The problem is, it doesn't work.&nbsp; I know the method is being
invoked
<br>> because there is some other text that is indeed being inserted.
<br>> Moreover, there are sub-folders in the folder that calls the method.
<br>>
<br>> Does anyone know what the problem is?&nbsp; Is it a permission issue.&nbsp;
The
<br>> standard_html_header and _footer, show up just fine, along with logos
<br>> and such.&nbsp; The only part that isn't showing up is the stuff
that was
<br>> supposed to be generated by the &lt;dtml-in> block.
<br>>
<br>> Any hints?
<br>>
<br>> Thanks in advance.
<br>>
<br>> Ron
<br>>&nbsp; ./.
<br>>
<br>>
<br>> _______________________________________________
<br>> Zope maillist&nbsp; -&nbsp; Zope@zope.org
<br>> <a href="http://lists.zope.org/mailman/listinfo/zope">http://lists.zope.org/mailman/listinfo/zope</a>
<br>> **&nbsp;&nbsp; No cross posts or HTML encoding!&nbsp; **
<br>> (Related lists -
<br>>&nbsp; <a href="http://lists.zope.org/mailman/listinfo/zope-announce">http://lists.zope.org/mailman/listinfo/zope-announce</a>
<br>>&nbsp; <a href="http://lists.zope.org/mailman/listinfo/zope-dev">http://lists.zope.org/mailman/listinfo/zope-dev</a>
)
<p>_______________________________________________
<br>Zope maillist&nbsp; -&nbsp; Zope@zope.org
<br><a href="http://lists.zope.org/mailman/listinfo/zope">http://lists.zope.org/mailman/listinfo/zope</a>
<br>**&nbsp;&nbsp; No cross posts or HTML encoding!&nbsp; **
<br>(Related lists -
<br>&nbsp;<a href="http://lists.zope.org/mailman/listinfo/zope-announce">http://lists.zope.org/mailman/listinfo/zope-announce</a>
<br>&nbsp;<a href="http://lists.zope.org/mailman/listinfo/zope-dev">http://lists.zope.org/mailman/listinfo/zope-dev</a>
)</blockquote>

<pre>--&nbsp;
Manuel Amador (Rudd-O)</pre>
&nbsp;</html>

--------------0D43265D657296791815E7E1--