dtml syntax for showing folder objects?
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?
+-------[ 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. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
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>
participants (3)
-
Andrew Kenneth Milton -
Kapil Thangavelu -
sean@horse101.com