views:

50

answers:

3

Folks I am trying to build a sitemap (we need one badly) for a huge multi-page web app. Technically its not much more than a collection of php/MySQL web forms that use javascript instead of traditional linkage to access the many pages.

<td width="100" align="center" ONMOUSEOVER="this.className='bgover'" ONMOUSEOUT="this.className='bgout'" onclick="location.href='../main.php'">Main Page</td>

Above is code sample of how the links are currently managed. I know I can search through the various pages, nearly a 1000, and find these "location.href" variables and that will help me a sitemap for each section. But maybe there is an easier way? WE use Trac and SVN so perhaps I am going about this the wrong way? Any advice would be appreciated.

A: 

My recommendation is to fix the code. You could create a php script that could replace that code with

<td width="100" align="center" ONMOUSEOVER="this.className='bgover'" ONMOUSEOUT="this.className='bgout'"><a href="../main.php">Main Page</a></td>

If this is not an option you could write a script that goes through your entire site folder structure and creates a sitemap from all the files. Depending on your folder structure it could be quite easy.

Galen
I could replace the code but this would require extensive testing and really the navigation is the least of my issues presently.
THX1138.6
+2  A: 

You could use the recursive directory iterator to get a list of all the pages in your site.

This is dependent on whether or not you want every page to be visible to the outside world. If you have some config or private/admin files I would suggest moving them outside of the web root, or only putting your public stuff inside a particular folder.

Edit: Your question is very confusing, I will delete this answer if I misunderstood your question.

Lotus Notes
I think the fault is mine. I should have been more clear but I think you understood my question. The iterator looks promising. The sitemap is for our purposes and won't be made public. The webserver is internal so its not open to the outside world. Thanks for the response!
THX1138.6
A: 

So how does someone with javascript disabled on their browser navigate your site? Not having regular anchor tags for linking pages is a very bad way of doing things. I would probably use something like

grep -ri /location\.href='[^']/ . > links

to build a file called links that shows each line of code containing a javascript link and use it as the first step to building the sitemap. Without much more information on the structure of your system, its difficult to give more direction than that.

DBruns
They don't its an internal website. Not my design it was here when I got here. I like your idea and thanks for that. Its a basic LAMP server.
THX1138.6