I have a site that has some fairly complex file paths. For instance, a simplified version would look like
/Project /Project/pages /Project/pages/A /Project/pages/A/1 /Project/pages/A/1/i page1.html page2.html page3.html /Project/pages/A/1/ii page1.html page2.html /Project/pages/A/2 /Project/pages/A/2/i page1.html page2.html /Project/pages/A/2/ii page1.html page2.html page3.html page4.html /Project/pages/B ... (This will look similar to directory A above) ...
I will often be adding to these files and directories, and I want the links between pages to update automatically. For instance, I want a breadcrumbs bar that will have a drop-down menu. So suppose that you’re at page
which in the breadcrumbs bar will look like
C > 5 > iii > page3
When you hover over the C it should drop-down all the options in that directory, so A, B, C, D, for instance. When you hover over 5 it should drop-down all the options inside of the C folder only. So if C has sub-directories 1, 2, 3, 4, and 5, it displays all of these.
So what it seems like I need to do is: For any given page, I need to detect all of the files that are siblings (i.e. in the same folder) and put them in the breadcrumbs. Then I need to look a directory above, and detect all of the directories that are siblings there, and include those paths in the breadcrumbs. Do it again, and again, until it reaches the
/Project/pages directory. Since I don’t know in advance how deep the directories will go or how many there will be, I need to do this in a recursive way, I think. So does anyone have any suggestions about how I might attempt this?