[Zope] path...

After Dark afterz@zipmail.com
Thu, 05 Apr 2001 14:27:58 -0400


I did what you told me, but the method assumed the context
of the file wich called it.
Like this:

myserver/
myserver/arvore_dtml
myserver/dir_restrict/calls_dtml
myserver/dir1/
myserver/dir2/
myserver/arq_x

I`m calling the arvore_dtml(code you sent) from calls_dtml,
but I want to list files and dirs from myserver. What is
happening is that it is listing from dir_restrict.
Did I make something wrong?

Bye.

On Thu, 05 Apr 2001 12:08:45 -0600
Casey Duncan <cduncan@kaivo.com> wrote:
>After Dark wrote:
>> 
>> Well, probably I`m trying in the hardest way... And I
>> already read the book ch3... what I want to do is to
>list
>> directories. The problem is that the document that list
>is
>> in a directory below of the directories to list.
>> 
>> I tryed many diferent ways, but all I could do was list
>some
>> directories, but when I tryed to list the subdirectory
>of
>> the subdirectory of...., didn`t work.
>> 
>> Take a look at my code:
>> 
>> <dtml-if "REQUEST.has_key('parametro')==1">
>> 
>> <dtml-call "REQUEST.set('base',_.getitem(base+'.'+parametro))">
>> "<dtml-var base>"
>> 
>> <table>
>> <dtml-with base>
>> <dtml-in objectItems>
>>    <td>
>>    <dtml-if "meta_type=='Folder'">
>>      <IMG SRC="../imagens/Folder_icon.gif">
>>      <td><a href="arvore_dtml?base=<dtml-var
>> base>&parametro=<dtml-var id>"><dtml-var id></a>
>>    <dtml-else>
>>      <IMG SRC="../imagens/iconImage.jpg">
>>      <td><dtml-var id>
>>    </dtml-if>
>>   </tr>
>> </dtml-in>
>> </dtml-with>
>> </table>
>> 
>> Thanks...
>> 
>
>What you appear to be doing is a drill down. Try this:
>
>create a dtml Method called arvore_dtml or whatever and
>put it _above_
>the folders you want to list. Put this DTML into it
>(untested):
>
><table>
><dtml-in name="objectValues">
>    <tr />
>        <td />
>        <img src="<dtml-var name="icon">" />
>        <td />
>        <dtml-if "meta_type=='Folder'">
>            <a href="&dtml-absolute_url;/arvore_dtml">&dtml-id;</a>
>        <dtml-else>
>            <a href="&dtml-absolute_url;">&dtml-id;</a>
>        </dtml-if>
></dtml-in>
></table>
>
>Then call it within the context of the top folder like so:
>
>http://myserver/topfolder/arvore_dtml
>
>This technique uses the context of the current folder as a
>reference. It
>spares you having to pass around names explicitly in
>REQUEST. This code
>uses the default zope icons, you can of course substitute
>whatever icons
>you like.
>
>hth,
>-- 
>| Casey Duncan
>| Kaivo, Inc.
>| cduncan@kaivo.com
>`------------------>

________________________________________________
Don't E-Mail, ZipMail! http://www.zipmail.com/