Posted by Steve on 06/06/07 13:11
I have been studying the Adjacency List Model as a means of achieving
a folder structure in a project I am working on. Started with the
excellent article by Gijs Van Tulder
http://www.sitepoint.com/article/hierarchical-data-database
My database has this basic structure:
Id
FolderName
ChildOf
where ChildOf is the Id of the Folder that the current folder is
nested within.
Although I can use this to make indented text lists - I want the
output to be a hierarchical HTML structured list using <ol><li>
structures.
So, for example, my folders are:
News
-Government Information
-BBC
-National Press
Books
LIS
-UKEIG
-NPRIE
I want the output to be:
<ol>
<li>News
<ol>
<li>Government Information</li>
<li>BBC></li>
<li>National Press</li>
</ol>
</li>
<li>Books</li>
<li>LIS
<ol>
<li>UKEIG</li>
<li>NPRIE</li>
</ol>
</li>
</ol>
and for this to work irrespective of the number of levels in the
hierarchy.
Any ideas?
Navigation:
[Reply to this message]
|