I have under my media section a special folder with uploads. Stuctured as folllowing:
Root
- Special folder
- - Subfolder
- - File 1 (created 13 feb)
- - File 4 (created 15 feb)
- - Sub-Subfolder
- - - File 2 (created 14 feb)
- - - File 3 (created 14 feb)
- - - File 5 (created 16 feb)
- Other folder
What I try to achieve is to get the 5 latest uploads from this "special folder". Currently I have a recursive function which gives me the following result: (which obviously is the order of the tree)
File 1
File 4
File 2
File 3
File 5
Of course.. that's not what I want. I would like to have a result for example:
File 5
File 4
File 3
File 2
File 1
My best guess just would be creating a huge collection of all nodes under the special folder, and later on sort this collection using a date entity. However, that doesn't sound too smart and with many files I think it's a waste of resources collecting all items to eventually display 5 of them.
How to get latest nodes programmatically?
Dear community,
I have under my media section a special folder with uploads. Stuctured as folllowing:
Root
In xslt, you can sort the nodes by created date within a for-each loop.
Thanks for your reply Daniel. I'm trying to achieve this in a user control.
For those looking for a solution in this topic. I solved it like this:
Wrote a class mediaNodes which recursively collects all files falling under a parent node. Return a List object with a file properties.
In actual user control I sort and limit the results.
is working on a reply...