Plone: Reverse Folder Contents in TAL Define
Using TAL, I needed to display the folder contents with dates ascending (newest first). By default context/folderlistFolderContents returns the tuple descending.
So I fixed it by using a ternary statment hack, that evaluates both entries/blocks.
So I fixed it by using a ternary statment hack, that evaluates both entries/blocks.
[code]
<metal:fill fill-slot="main">
<metal:main_macro define-macro="main"
tal:define="portal_type python:here.getPortalTypeName().lower().replace(' ', '_');
folder_list context/folderlistingFolderContents;
folder_list python: (folder_list.reverse(), folder_list)[1];
base_macros here/base/macros;
view_template python:'%s_view' % portal_type;
<!-- rest of code -->
[/code]
Comments