Hi everyone,
I looked through the related questions for a similar question but I wasn't seeing quite what I need, pardon if this has already been answered already. In my database I have a list of records that I want represented to the user as files inside of a folder structure. So for each record I have a VARCHAR column called "FolderStructure" that I want to identify that records place in to the folder structure. The series of those flat FolderStructure string columns will create my tree structure with the folders being seperated by backslashes (naturally). I didn't want to add another table just to represent a folder structure... The 'file' name is stored in a separate column so that if the FolderStructure column is empty, the file is assumed to be at the root folder.
What is the best way to turn a collection of these records into a series of HTML UL/LI tags... where each LI represents a file and each folder structure being an UL embedded inside it's parent??
So for example:
file - folderStructure
foo -
bar - firstDir
blue - firstDir/subdir
would produce the following HTML:
<ul>
<li>foo</li>
<ul>
<li> bar </li>
<ul>
<li> blue </li>
</ul>
</ul>
</ul>
Thanks