[ZPT] Re: single TAL file for displaying contents!

Tonico Strasser contact_tonico at yahoo.de
Tue Jul 27 07:38:41 EDT 2004


>> Is it possible to display the contents of different
>> folders by creating a single page template?

Just found another (experimental) way to browse the folder contents.

1. Create a script called 'browse' and a ZPT called 'folder_contents'
    (or similar) at your site root:

2. Content of the script 'browse':

    # data root
    folder = context.data
    try:
        folder = folder.restrictedTraverse('/'.join(traverse_subpath))
    except:
        #404
        pass

    return getattr(folder, 'folder_contents')()

3. You should now be able to browse your folder with one page template
    (and one script):

    example.org/browse/folder-a/folder-aa

Tonico



More information about the ZPT mailing list