Page 1 of 1
View directory
Posted: Thu May 16, 2013 12:20 pm
by whitewabbit
I am looking for a way to view all the files in a specific directory based on the page users are on (eg. page 1 show files in directory A, page 2 show files in directory B etc) I can do it kind of with the download manager plugin but you have to upload one file at a time and assign a user at a time to it which is not practical given the number of files I have to use.
is there a plugin that will do this? Or maybe a bit of code I can drop into a page? I would also like to show the files size as well at the file name and do not want the users to be able to navigate outside the assigned directory.
Any help would be appreciated.
Thanks
Re: View directory
Posted: Thu May 16, 2013 1:07 pm
by Rolf
Re: View directory
Posted: Thu May 16, 2013 1:22 pm
by velden
You might want to have a look at the 'assign' tag of Smarty.
Small example (not tested):
Code: Select all
{assign var='teaser' value='uploads/images/teaser/*.JPG'|glob}
{foreach from=$teaser item='one'}
<div><a href="{root_url}/{$one}">{$one}</a></div>
{/foreach}
Of course you can change the file mask and do some other stuff before displaying
Re: View directory
Posted: Thu May 16, 2013 1:57 pm
by whitewabbit
Yes that's right, works fine thanks. the only other thing that would be good to have would be a tick box next to each file and a download button at the bottom. Don't think you can do that with this but in a perfect world that's what I want to do if I can.
Re: View directory
Posted: Thu May 16, 2013 2:10 pm
by velden
whitewabbit wrote:
Yes that's right, works fine thanks. the only other thing that would be good to have would be a tick box next to each file and a download button at the bottom. Don't think you can do that with this but in a perfect world that's what I want to do if I can.
Guess that would involve a kind of client side download manager and/or a server side module to zip the (shopping cart) and deliver it as one downloadable file.
Re: View directory
Posted: Thu May 16, 2013 2:20 pm
by Rolf
Try Uploads module!