I'm just wondering on peoples opinions here, and perhaps some guidance on how best to implement something.
What I have, is a very basic intranet, simply designed to serve up company wide documents and files. It has a basic menu bar across the top of the page, that has a top level item, and then sub menus/items. Obviously the menu can cascade down many levels, and is a simple javascript I got of dynamic drive, that turns an html < li > structure into the menu.
Basic idea is this:
<li><a href='#'>Top Level 1</a>
<ul>
<li><a href='#'>Item 1</a></li>
<li><a href='#'>Item 2</a></li>
<li><a href='#'>Sub menu 1</a>
<ul>
<li><a href='#'>Sub Item 1</a></li>
</ul>
</li>
</ul>
</li>
So this is used to create the menu. Every time you start a new < ul > element, it will create a sub menu.
This works fine, but is a bit of a pain as I have to manually go in an create new links, delete old ones etc. everytime there is a change in documents on the site.
What I am looking to do, is move this structure into my database, so that I can use basic html forms, and PHP scripts to insert, update and delete links when needed.
It also gives managers the ability to upload new files if I am not available to do so.
I have had a quick play with this, and have found an option that kind of works, but is a bit clunky and could be a pain to maintain going forward.
Basically, I would have a table with the columns listed below:
What I can do, is to have a unique ID for reference, input the filename and file path that together can be used for the href link to point to the files location. I can then use the menu and 3 sub menu fields to tell it where to place that item in the menu structure. The label just gives a name to the link, and the open in tells the page where to open the document, i.e. _new, frame, ifram etc.
The PHP can then use a mysql query to find all items in a menu and echo them out. The problem comes that I would need a seperate MySQL query for each menu and sub menu that I have, meaning that the entire menu may well end up being full of MySQL queries.
Can anyone advise on a better solution to this, or help make the PHP as simple and flexible as possible?
Many thanks
Eds
Edit:
Can provide some examples of PHP if required, but they are quite large.