Idea behind this is an option to let the customer upload all files i.e.pdfs (of unpredictable count) into one folder and the select the ‘downloads’ folder in the resource. I as developer provide a snippet that lists all appropriate files of that folder via download-link. or image gallery or sound-widgets…
Is it possible that in all those years nobody else deeded something like this? It would be a very reasonable part of the default tv-types.
I am currently working with modx 3.0.3 on latest debian.
Is there perhaps anybody who could provide a 1-2-3 description on how to - or is it more delicate?
It may depend on how many folders / levels you need to list.
It may be the case that you really need full, interactive access to a collapsible tree of folders to allow a selection to be made. In that case - I’m not sure how best to advise.
But if you only need to list the children of a parent folder - what @bruno17 suggested should be possible - I did something similar recently like this:
Thank you very much, bruno, for pointing that out!
Since I don’t need TV-bindings too often I was under the false impression, that together with the removed @EVAL binding @snippet was abandoned as well with version 3. Had been prudent to try first.
I mixed up the memory about a post I read in the past that discussed some thoughts about security vectors.
This for sure works for many usecases perfectly and mixes great with a listbox TV!
Also many thanks to you, dejaya!
The code is neat and working. And at least a useful start for everyone with the same need.
I will write one for my needs.
Your mentioning of the issue of interactivity in this matter however puts me right to my point of confusion here:
One might wonder that there is a file-tv and image-tv since - ever, and it ueses the (respectable if not wonderful) modx-file-browser … but that very browser is not as well available “just” to select a directory.
I imagine there could be a ton of reasons why this might be a too easy thought.