[Zope] dtml syntax for showing folder objects?

Kapil Thangavelu kthangavelu@earthlink.net
Wed, 23 Aug 2000 14:06:13 -0700


Andrew Kenneth Milton wrote:
> 
> +-------[ sean@horse101.com ]----------------------
> | Hi,
> | I wonder how one would show the dtml documents in a folder with a
> | dtml statement.  I see it working with the tree command and I see
> | it working in Yihaw, but there must be a simple way to show just
> | files as links by some sort of call with the subfolder name.  Any
> | ideas?
> 
> Here's possibly the ugliest idea..
> 
> <dtml-with SubFolder>
> <dtml-in "objectIds()">
> <a href="<dtml-var "_.getitem(_['sequence-item'],0).absolute_url()">"><dtml-var sequence-item></a><br>
> </dtml-in>
> </dtml-with>
> 
> We use objectIds() rather than objectValues in case you want to pass a mask
> to objectIds(). This way we only instantiate the objects we're interested
> it.
> 
> We could have used nested calls to getitem, but, that wasn't as funky looking.


FYI you can pass a mask to objectIds as well. 

<dtml-with SubFolder>
<dtml-in "objectItems(['DTML Document'])">
<a href="&dtml-var.absolute_url"><dtml-var sequence-key></a>
</dtml-in>
</dtml-with>