Hi There guys. I’ve got a bit of a nippy one here and would just like peoples opinions on the best way to do this (to avoid headaches).
I have been following a [URL=http://www.intranetjournal.com/articles/200412/ij_12_08_04a.html]CMS creation tutorial
The database is set up so that an articles foreign key is the primery key of the section that it belongs to.
The problem I am having is trying to create a symantically correct menu of the sections due to the fact that each section can have a parent.
The section table schema is as follows cmssections([U]ID[I]parentid
I would like to create a list along these lines.
[code=html]<ul>
<li>Section1</li>
<li>Section2
<ul>
<li>Subsection1</li>
<li>Subsection2
<ul>
<li>Subsubsection1</li>
</ul>
</li>
</ul>
</li>
<li>Section3</li>
</ul>
I searched the forum for an answer and although there were quite a few relating to dynamically created menus, none really were relevant.
Can people give me their views on what would be the best way to create a loop which would create a list as above?
I was thinking of adding a column into the table, “has_children” and then if a row “has_children” then php would execute a query looking for all sections with that parent.
I hope this makes sense. If anyone has any ideas on how I could do this in a more efficient way please do say so. I would be happy to hear all suggestions.
Thanks
Graham