1

I'm just moving in to the next phase of a large project and trying to work out the best way to tackle it, or indeed if any add-ons exist that might help.

This part of the project is basically a document repository. A collection of various types of files that will be arranged, and displayed, in what are essentially folders and sub-folders. The user will be able to drill down through the folders to locate the files they want (or use a search facility).

The functionality is being driven largely by the client's existing set up and I'm wondering is there might be a better way. I'm normally against rigid organisation of assets like this and prefer a tagging solution though in this case perhaps that would be a step too far.

My first thought is to simply use categories (either on entries or using the files module) - it could be that simple - but I'm wondering if there are any add-ons that might assist in building this or indeed, if anyone else has built something like this and come across any "gotchas" that I haven't yet thought of.

EDIT: Reading that back I realised I had used the word "assets". Maybe that's a subconscious hint to myself! I haven't used the add-on Assets in this way before - is this something that Assets would be suited to?

1

I've used P&T's Assets to create something similar to this. They wanted to display their current document repository on their website using the same folder structure.

With the latest version of Assets, you can upload everything to the server via FTP, then use Assets to sync it with EE; you just create the file upload location as the parent folder of the repository.

On the front end I created links that mirrored the folder structure, i.e. you'd click on links to move down through folders. If any files existed in the folder, they'd display below the links to folders.

This is the template code I used:

{exp:assets:folders folder="{filedir_3}{if segment_2}{segment_2}/{/if}{if segment_3}{segment_3}/{/if}{if segment_4}{segment_4}/{/if}{if segment_5}{segment_5}/{/if}"}
{if folder_name}<h3 class="folder"><a href="/{segment_1}/{if segment_2}{segment_2}/{/if}{if segment_3}{segment_3}/{/if}{if segment_4}{segment_4}/{/if}{folder_name}/">{folder_name}</a></h3>{/if}
<ul>
    {exp:assets:files folder="{filedir_3}{if segment_2}{segment_2}/{/if}{if segment_3}{segment_3}/{/if}{if segment_4}{segment_4}/{/if}{if segment_5}{segment_5}/{/if}"}
    <li><a href="{exp:protected_links:generate url='{url}' ip_lock='yes' only_link='yes' storage='local'}" class="file {extension}">{exp:low_replace find="_" replace="SPACE"}{filename}{/exp:low_replace}</a></li>
    {/exp:assets:files}
</ul>

It looks a bit untidy because I had to hard code the number of levels. I did this when Assets 2 was still in beta which was a while ago and was a bit pressed for time, so not sure if there's a way more native to Assets available now.

| improve this answer | |
  • I tried it with Assets 2 last night because it did seem like a viable way to do it. However I can't get Assets to show files on the front end. Folders, no problem, files nope. I think this is to do with the way I'm specifying upload directory paths so I'm hoping to sort that today. Ran into a brick wall with it last night though. – foamcow May 5 '13 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.